create sequence seq_gen_table
    increment by 1
    start with 1
    nomaxvalue
    nominvalue
    cache 20;

create table gen_table (
                           table_id           bigint       not null,
                           table_name         varchar2(200) default '',
                           table_comment      varchar2(500) default '',
                           sub_table_name     varchar2(64) default null,
                           sub_table_fk_name  varchar2(64) default null,
                           class_name         varchar2(100) default '',
                           tpl_category       varchar2(200) default 'crud',
                           tpl_web_type       varchar2(30) default '',
                           package_name       varchar2(100) default null,
                           module_name        varchar2(30) default null,
                           business_name      varchar2(30) default null,
                           function_name      varchar2(50) default null,
                           function_author    varchar2(50) default null,
                           gen_type           char(1) default '0',
                           gen_path           varchar2(200) default '/',
                           options            varchar2(1000) default null,
                           create_by          varchar2(64) default '',
                           create_time        DATETIME,
                           update_by          varchar2(64) default '',
                           update_time        DATETIME,
                           remark             varchar2(500) default null
);

alter table gen_table add constraint pk_gen_table primary key (table_id);

comment on table gen_table is '代码生成业务表';
comment on column gen_table.table_id is '编号';
comment on column gen_table.table_name is '表名称';
comment on column gen_table.table_comment is '表描述';
comment on column gen_table.sub_table_name is '关联子表的表名';
comment on column gen_table.sub_table_fk_name is '子表关联的外键名';
comment on column gen_table.class_name is '实体类名称';
comment on column gen_table.tpl_category is '使用的模板（crud单表操作 tree树表操作）';
comment on column gen_table.tpl_web_type is '前端模板类型（element-ui模版 element-plus模版）';
comment on column gen_table.package_name is '生成包路径';
comment on column gen_table.module_name is '生成模块名';
comment on column gen_table.business_name is '生成业务名';
comment on column gen_table.function_name is '生成功能名';
comment on column gen_table.function_author is '生成功能作者';
comment on column gen_table.gen_type is '生成代码方式（0zip压缩包 1自定义路径）';
comment on column gen_table.gen_path is '生成路径（不填默认项目路径）';
comment on column gen_table.options is '其它生成选项';
comment on column gen_table.create_by is '创建者';
comment on column gen_table.create_time is '创建时间';
comment on column gen_table.update_by is '更新者';
comment on column gen_table.update_time is '更新时间';
comment on column gen_table.remark is '备注';

CREATE OR REPLACE TRIGGER trg_gen_table_before_insert
    BEFORE INSERT ON gen_table
    FOR EACH ROW
BEGIN
    SELECT seq_gen_table.NEXTVAL INTO :NEW.table_id FROM DUAL;
END;

-- 创建序列对象，用于主键自增
create sequence seq_gen_table_column
    increment by 1
    start with 1
    nomaxvalue
    nominvalue
    cache 20;

-- 创建表结构
create table gen_table_column (
                                  column_id         bigint       not null, -- 编号
                                  table_id          bigint       default null, -- 归属表编号
                                  column_name       varchar2(200) default null, -- 列名称
                                  column_comment    varchar2(500) default null, -- 列描述
                                  column_type       varchar2(100) default null, -- 列类型
                                  java_type         varchar2(500) default null, -- JAVA类型
                                  java_field        varchar2(200) default null, -- JAVA字段名
                                  is_pk             char(1)      default null, -- 是否主键（1是）
                                  is_increment      char(1)      default null, -- 是否自增（1是）
                                  is_required       char(1)      default null, -- 是否必填（1是）
                                  is_insert         char(1)      default null, -- 是否为插入字段（1是）
                                  is_edit           char(1)      default null, -- 是否编辑字段（1是）
                                  is_list           char(1)      default null, -- 是否列表字段（1是）
                                  is_query          char(1)      default null, -- 是否查询字段（1是）
                                  query_type        varchar2(200) default 'EQ', -- 查询方式（等于、不等于、大于、小于、范围）
                                  html_type         varchar2(200) default null, -- 显示类型（文本框、文本域、下拉框、复选框、单选框、日期控件）
                                  dict_type         varchar2(200) default '', -- 字典类型
                                  sort              int          default null, -- 排序
                                  create_by         varchar2(64) default '', -- 创建者
                                  create_time       DATETIME, -- 创建时间
                                  update_by         varchar2(64) default '', -- 更新者
                                  update_time       DATETIME -- 更新时间
);

-- 添加主键约束
alter table gen_table_column add constraint pk_gen_table_column primary key (column_id);

-- 添加注释
comment on table gen_table_column is '代码生成业务表字段';
comment on column gen_table_column.column_id is '编号';
comment on column gen_table_column.table_id is '归属表编号';
comment on column gen_table_column.column_name is '列名称';
comment on column gen_table_column.column_comment is '列描述';
comment on column gen_table_column.column_type is '列类型';
comment on column gen_table_column.java_type is 'JAVA类型';
comment on column gen_table_column.java_field is 'JAVA字段名';
comment on column gen_table_column.is_pk is '是否主键（1是）';
comment on column gen_table_column.is_increment is '是否自增（1是）';
comment on column gen_table_column.is_required is '是否必填（1是）';
comment on column gen_table_column.is_insert is '是否为插入字段（1是）';
comment on column gen_table_column.is_edit is '是否编辑字段（1是）';
comment on column gen_table_column.is_list is '是否列表字段（1是）';
comment on column gen_table_column.is_query is '是否查询字段（1是）';
comment on column gen_table_column.query_type is '查询方式（等于、不等于、大于、小于、范围）';
comment on column gen_table_column.html_type is '显示类型（文本框、文本域、下拉框、复选框、单选框、日期控件）';
comment on column gen_table_column.dict_type is '字典类型';
comment on column gen_table_column.sort is '排序';
comment on column gen_table_column.create_by is '创建者';
comment on column gen_table_column.create_time is '创建时间';
comment on column gen_table_column.update_by is '更新者';
comment on column gen_table_column.update_time is '更新时间';

CREATE OR REPLACE TRIGGER trg_gen_table_column_before_insert
    BEFORE INSERT ON gen_table_column
    FOR EACH ROW
BEGIN
    SELECT seq_gen_table_column.NEXTVAL INTO :NEW.column_id FROM DUAL;
END;

-- 创建序列对象，用于主键自增
create sequence seq_indicator_management
    increment by 1
    start with 1
    nomaxvalue
    nominvalue
    cache 20;

-- 创建表结构
create table indicator_management (
                                      id                     bigint       not null, -- 主键id
                                      application_category   varchar2(100) not null, -- 应用分类
                                      belonging_application  varchar2(100) not null, -- 所属应用
                                      indicator_name         varchar2(100) not null, -- 指标名称
                                      indicator_type         varchar2(50)  not null, -- 指标类型
                                      value_type             varchar2(50)  not null, -- 值类型
                                      report_frequency       varchar2(50)  not null, -- 报告频度
                                      application_dimension  varchar2(100) not null, -- 应用维度
                                      department             varchar2(100) not null, -- 归口部门
                                      storage_precision      int           default null, -- 存储精度
                                      display_precision      int           default null, -- 展示精度
                                      calculation_formula    clob          default null, -- 计算公式
                                      indicator_description  clob          default null, -- 指标描述
                                      application_system     varchar2(255) default null, -- 应用系统
                                      data_source            varchar2(255) not null, -- 数据来源
                                      status                 int           default 0, -- 状态（0正常 1停用）
                                      approve_status         int default 3, -- 审批状态: 0.不通过 1.生效中，2待审核，3待提交
                                      create_by              varchar2(64)  default '', -- 创建者
                                      create_time            DATETIME, -- 创建时间
                                      update_by              varchar2(64)  default '', -- 更新者
                                      update_time            DATETIME -- 更新时间
);

-- 添加主键约束
alter table indicator_management add constraint pk_indicator_management primary key (id);

-- 添加注释
comment on table indicator_management is '指标管理表';
comment on column indicator_management.id is '主键id';
comment on column indicator_management.application_category is '应用分类';
comment on column indicator_management.belonging_application is '所属应用';
comment on column indicator_management.indicator_name is '指标名称';
comment on column indicator_management.indicator_type is '指标类型';
comment on column indicator_management.value_type is '值类型';
comment on column indicator_management.report_frequency is '报告频度';
comment on column indicator_management.application_dimension is '应用维度';
comment on column indicator_management.department is '归口部门';
comment on column indicator_management.storage_precision is '存储精度';
comment on column indicator_management.display_precision is '展示精度';
comment on column indicator_management.calculation_formula is '计算公式';
comment on column indicator_management.indicator_description is '指标描述';
comment on column indicator_management.application_system is '应用系统';
comment on column indicator_management.data_source is '数据来源';
comment on column indicator_management.status is '状态（0正常 1停用）';
comment on column indicator_management.approve_status is '审批状态: 0.不通过 1.生效中，2待审核，3待提交';
comment on column indicator_management.create_by is '创建者';
comment on column indicator_management.create_time is '创建时间';
comment on column indicator_management.update_by is '更新者';
comment on column indicator_management.update_time is '更新时间';

CREATE OR REPLACE TRIGGER trg_indicator_management_before_insert
    BEFORE INSERT ON indicator_management
    FOR EACH ROW
BEGIN
    SELECT seq_indicator_management.NEXTVAL INTO :NEW.id FROM DUAL;
END;


-- 创建序列对象，用于主键自增
CREATE SEQUENCE seq_metadata_tag
    INCREMENT BY 1
    START WITH 1
    NOMAXVALUE
    NOMINVALUE
    CACHE 20;

-- 创建表结构
CREATE TABLE metadata_tag (
                              id               BIGINT NOT NULL, -- 主键id
                              tag_name         VARCHAR2(100) DEFAULT NULL, -- 标签名称
                              tag_classify     VARCHAR2(100) DEFAULT NULL, -- 标签分类
                              status           INT DEFAULT 0, -- 状态（0正常 1停用）
                              create_by        VARCHAR2(64) DEFAULT '', -- 创建者
                              create_time      DATETIME  DEFAULT NULL, -- 创建时间
                              update_by        VARCHAR2(64) DEFAULT '', -- 更新者
                              update_time      DATETIME  DEFAULT NULL, -- 更新时间
                              is_deleted       INT DEFAULT 0 -- 是否删除（0存在，1删除）
);

-- 添加主键约束
ALTER TABLE metadata_tag ADD CONSTRAINT pk_metadata_tag PRIMARY KEY (id);

-- 添加注释
COMMENT ON TABLE metadata_tag IS '元数据标签表';
COMMENT ON COLUMN metadata_tag.id IS '主键id';
COMMENT ON COLUMN metadata_tag.tag_name IS '标签名称';
COMMENT ON COLUMN metadata_tag.tag_classify IS '标签分类';
COMMENT ON COLUMN metadata_tag.status IS '状态（0正常 1停用）';
COMMENT ON COLUMN metadata_tag.create_by IS '创建者';
COMMENT ON COLUMN metadata_tag.create_time IS '创建时间';
COMMENT ON COLUMN metadata_tag.update_by IS '更新者';
COMMENT ON COLUMN metadata_tag.update_time IS '更新时间';
COMMENT ON COLUMN metadata_tag.is_deleted IS '是否删除（0存在，1删除）';

-- 创建触发器，实现主键自增
CREATE OR REPLACE TRIGGER trg_metadata_tag_before_insert
    BEFORE INSERT ON metadata_tag
    FOR EACH ROW
BEGIN
    SELECT seq_metadata_tag.NEXTVAL INTO :NEW.id FROM DUAL;
END;

-- 创建表结构
CREATE TABLE metadata_tag_relation (
                                       tag_id       INT DEFAULT NULL, -- 标签id
                                       metadata_id  VARCHAR2(50) DEFAULT NULL, -- 元数据id
                                       is_field     INT DEFAULT NULL, -- 是否字段绑定（0是 1不是）
                                       field_id     VARCHAR2(50) DEFAULT NULL -- 字段id
);

-- 添加注释
COMMENT ON TABLE metadata_tag_relation IS '元数据标签关联表';
COMMENT ON COLUMN metadata_tag_relation.tag_id IS '标签id';
COMMENT ON COLUMN metadata_tag_relation.metadata_id IS '元数据id';
COMMENT ON COLUMN metadata_tag_relation.is_field IS '是否字段绑定（0是 1不是）';
COMMENT ON COLUMN metadata_tag_relation.field_id IS '字段id';




-- 创建序列对象，用于主键自增
CREATE SEQUENCE seq_network_transfer
    INCREMENT BY 1
    START WITH 1
    NOMAXVALUE
    NOMINVALUE
    CACHE 20;

-- 创建表结构
CREATE TABLE network_transfer (
                                  id               BIGINT NOT NULL, -- 主键id
                                  send_reason      VARCHAR2(100) NOT NULL, -- 发送缘由
                                  db_conn_id       VARCHAR2(100) DEFAULT NULL, -- 数据源id
                                  send_type        VARCHAR2(50) DEFAULT NULL, -- 传输类型
                                  network_type     INT DEFAULT NULL, -- 网段类型
                                  data_value       CLOB NOT NULL, -- 数据值
                                  send_dept        VARCHAR2(50) DEFAULT NULL, -- 发起部门
                                  send_user        VARCHAR2(50) DEFAULT NULL, -- 发起人员
                                  resource_path    VARCHAR2(255) DEFAULT NULL, -- 资源路径
                                  status           BIGINT DEFAULT 2, -- 审批状态: 0.不通过 1.通过，2待审核,3撤回
                                  create_by        VARCHAR2(64) DEFAULT '', -- 创建者
                                  create_time      DATETIME DEFAULT NULL, -- 创建时间
                                  update_by        VARCHAR2(64) DEFAULT '', -- 更新者
                                  update_time      DATETIME DEFAULT NULL, -- 更新时间
                                  data_before      CLOB DEFAULT NULL, -- 前数据
                                  data_after       CLOB DEFAULT NULL -- 后数据
);

-- 添加主键约束
ALTER TABLE network_transfer ADD CONSTRAINT pk_network_transfer PRIMARY KEY (id);

-- 添加注释
COMMENT ON TABLE network_transfer IS '跨网传输表';
COMMENT ON COLUMN network_transfer.id IS '主键id';
COMMENT ON COLUMN network_transfer.send_reason IS '发送缘由';
COMMENT ON COLUMN network_transfer.db_conn_id IS '数据源id';
COMMENT ON COLUMN network_transfer.send_type IS '传输类型';
COMMENT ON COLUMN network_transfer.network_type IS '网段类型';
COMMENT ON COLUMN network_transfer.data_value IS '数据值';
COMMENT ON COLUMN network_transfer.send_dept IS '发起部门';
COMMENT ON COLUMN network_transfer.send_user IS '发起人员';
COMMENT ON COLUMN network_transfer.resource_path IS '资源路径';
COMMENT ON COLUMN network_transfer.status IS '审批状态: 0.不通过 1.通过，2待审核,3撤回';
COMMENT ON COLUMN network_transfer.create_by IS '创建者';
COMMENT ON COLUMN network_transfer.create_time IS '创建时间';
COMMENT ON COLUMN network_transfer.update_by IS '更新者';
COMMENT ON COLUMN network_transfer.update_time IS '更新时间';
COMMENT ON COLUMN network_transfer.data_before IS '前数据';
COMMENT ON COLUMN network_transfer.data_after IS '后数据';


-- 创建序列对象，用于主键自增
CREATE SEQUENCE seq_operation_approve
    INCREMENT BY 1
    START WITH 1
    NOMAXVALUE
    NOMINVALUE
    CACHE 20;

-- 创建表结构
CREATE TABLE operation_approve (
                                   id               INT NOT NULL, -- 主键id
                                   property_id      INT DEFAULT NULL, -- 资产id
                                   property_type    VARCHAR2(50) DEFAULT NULL, -- 资产类型
                                   operation_type   INT DEFAULT NULL, -- 操作类型(1新增 2修改 3删除)
                                   before_change    CLOB DEFAULT NULL, -- 修改前数据
                                   after_change     CLOB DEFAULT NULL, -- 修改后数据
                                   approve_status   INT DEFAULT 1, -- 审批状态: 0.已审核 1.待审核
                                   approve_result   INT DEFAULT NULL, -- 审批结果: 0.拒绝 1.同意
                                   approve_reason   CLOB DEFAULT NULL, -- 审批理由
                                   is_deleted       INT DEFAULT 0, -- 是否删除（0存在，1删除）
                                   create_by        VARCHAR2(32) DEFAULT NULL, -- 申请人
                                   create_time      DATETIME DEFAULT NULL, -- 申请时间
                                   update_by        VARCHAR2(32) DEFAULT NULL, -- 修改人
                                   update_time      DATETIME DEFAULT NULL, -- 修改时间
                                   approve_by       VARCHAR2(255) DEFAULT NULL, -- 审批人
                                   approve_time     DATETIME DEFAULT NULL -- 审批时间
);

-- 添加主键约束
ALTER TABLE operation_approve ADD CONSTRAINT pk_operation_approve PRIMARY KEY (id);

-- 添加注释
COMMENT ON TABLE operation_approve IS '审批管理表';
COMMENT ON COLUMN operation_approve.id IS '主键id';
COMMENT ON COLUMN operation_approve.property_id IS '资产id';
COMMENT ON COLUMN operation_approve.property_type IS '资产类型';
COMMENT ON COLUMN operation_approve.operation_type IS '操作类型(1新增 2修改 3删除)';
COMMENT ON COLUMN operation_approve.before_change IS '修改前数据';
COMMENT ON COLUMN operation_approve.after_change IS '修改后数据';
COMMENT ON COLUMN operation_approve.approve_status IS '审批状态: 0.已审核 1.待审核';
COMMENT ON COLUMN operation_approve.approve_result IS '审批结果: 0.拒绝 1.同意';
COMMENT ON COLUMN operation_approve.approve_reason IS '审批理由';
COMMENT ON COLUMN operation_approve.is_deleted IS '是否删除（0存在，1删除）';
COMMENT ON COLUMN operation_approve.create_by IS '申请人';
COMMENT ON COLUMN operation_approve.create_time IS '申请时间';
COMMENT ON COLUMN operation_approve.update_by IS '修改人';
COMMENT ON COLUMN operation_approve.update_time IS '修改时间';
COMMENT ON COLUMN operation_approve.approve_by IS '审批人';
COMMENT ON COLUMN operation_approve.approve_time IS '审批时间';



-- ----------------------------
-- 1、存储每一个已配置的 jobDetail 的详细信息
-- ----------------------------
create table qrtz_job_details
(
    sched_name        varchar2(120) not null,
    job_name          varchar2(200) not null,
    job_group         varchar2(200) not null,
    description       varchar2(250) null,
    job_class_name    varchar2(250) not null,
    is_durable        varchar2(1) not null,
    is_nonconcurrent  varchar2(1) not null,
    is_update_data    varchar2(1) not null,
    requests_recovery varchar2(1) not null,
    job_data          blob null,
    constraint qrtz_job_details_pk primary key (sched_name, job_name, job_group)
);

-- ----------------------------
-- 2、 存储已配置的 Trigger 的信息
-- ----------------------------
create table qrtz_triggers
(
    sched_name     varchar2(120) not null,
    trigger_name   varchar2(200) not null,
    trigger_group  varchar2(200) not null,
    job_name       varchar2(200) not null,
    job_group      varchar2(200) not null,
    description    varchar2(250) null,
    next_fire_time number(13) null,
    prev_fire_time number(13) null,
    priority       number(13) null,
    trigger_state  varchar2(16) not null,
    trigger_type   varchar2(8) not null,
    start_time     number(13) not null,
    end_time       number(13) null,
    calendar_name  varchar2(200) null,
    misfire_instr  number(2) null,
    job_data       blob null,
    constraint qrtz_triggers_pk primary key (sched_name, trigger_name, trigger_group),
    constraint qrtz_trigger_to_jobs_fk foreign key (sched_name, job_name, job_group)
        references qrtz_job_details (sched_name, job_name, job_group)
);

-- ----------------------------
-- 3、 存储简单的 Trigger，包括重复次数，间隔，以及已触发的次数
-- ----------------------------
create table qrtz_simple_triggers
(
    sched_name      varchar2(120) not null,
    trigger_name    varchar2(200) not null,
    trigger_group   varchar2(200) not null,
    repeat_count    number(7) not null,
    repeat_interval number(12) not null,
    times_triggered number(10) not null,
    constraint qrtz_simple_trig_pk primary key (sched_name, trigger_name, trigger_group),
    constraint qrtz_simple_trig_to_trig_fk foreign key (sched_name, trigger_name, trigger_group)
        references qrtz_triggers (sched_name, trigger_name, trigger_group)
);

-- ----------------------------
-- 4、 存储 Cron Trigger，包括 Cron 表达式和时区信息
-- ----------------------------
create table qrtz_cron_triggers
(
    sched_name      varchar2(120) not null,
    trigger_name    varchar2(200) not null,
    trigger_group   varchar2(200) not null,
    cron_expression varchar2(120) not null,
    time_zone_id    varchar2(80),
    constraint qrtz_cron_trig_pk primary key (sched_name, trigger_name, trigger_group),
    constraint qrtz_cron_trig_to_trig_fk foreign key (sched_name, trigger_name, trigger_group)
        references qrtz_triggers (sched_name, trigger_name, trigger_group)
);

-- ----------------------------
-- 5、 Trigger 作为 Blob 类型存储(用于 Quartz 用户用 JDBC 创建他们自己定制的 Trigger 类型，JobStore 并不知道如何存储实例的时候)
-- ----------------------------
create table qrtz_blob_triggers
(
    sched_name    varchar2(120) not null,
    trigger_name  varchar2(200) not null,
    trigger_group varchar2(200) not null,
    blob_data     blob null,
    constraint qrtz_blob_trig_pk primary key (sched_name, trigger_name, trigger_group),
    constraint qrtz_blob_trig_to_trig_fk foreign key (sched_name, trigger_name, trigger_group)
        references qrtz_triggers (sched_name, trigger_name, trigger_group)
);

-- ----------------------------
-- 6、 以 Blob 类型存储存放日历信息， quartz可配置一个日历来指定一个时间范围
-- ----------------------------
create table qrtz_calendars
(
    sched_name    varchar2(120) not null,
    calendar_name varchar2(200) not null,
    calendar      blob not null,
    constraint qrtz_calendars_pk primary key (sched_name, calendar_name)
);

-- ----------------------------
-- 7、 存储已暂停的 Trigger 组的信息
-- ----------------------------
create table qrtz_paused_trigger_grps
(
    sched_name    varchar2(120) not null,
    trigger_group varchar2(200) not null,
    constraint qrtz_paused_trig_grps_pk primary key (sched_name, trigger_group)
);

-- ----------------------------
-- 8、 存储与已触发的 Trigger 相关的状态信息，以及相联 Job 的执行信息
-- ----------------------------
create table qrtz_fired_triggers
(
    sched_name        varchar2(120) not null,
    entry_id          varchar2(95) not null,
    trigger_name      varchar2(200) not null,
    trigger_group     varchar2(200) not null,
    instance_name     varchar2(200) not null,
    fired_time        number(13) not null,
    sched_time        number(13) not null,
    priority          number(13) not null,
    state             varchar2(16) not null,
    job_name          varchar2(200) null,
    job_group         varchar2(200) null,
    is_nonconcurrent  varchar2(1) null,
    requests_recovery varchar2(1) null,
    constraint qrtz_fired_trigger_pk primary key (sched_name, entry_id)
);

-- ----------------------------
-- 9、 存储少量的有关 Scheduler 的状态信息，假如是用于集群中，可以看到其他的 Scheduler 实例
-- ----------------------------
create table qrtz_scheduler_state
(
    sched_name        varchar2(120) not null,
    instance_name     varchar2(200) not null,
    last_checkin_time number(13) not null,
    checkin_interval  number(13) not null,
    constraint qrtz_scheduler_state_pk primary key (sched_name, instance_name)
);

-- ----------------------------
-- 10、 存储程序的悲观锁的信息(假如使用了悲观锁)
-- ----------------------------
create table qrtz_locks
(
    sched_name varchar2(120) not null,
    lock_name  varchar2(40) not null,
    constraint qrtz_locks_pk primary key (sched_name, lock_name)
);

create table qrtz_simprop_triggers
(
    sched_name    varchar2(120) not null,
    trigger_name  varchar2(200) not null,
    trigger_group varchar2(200) not null,
    str_prop_1    varchar2(512) null,
    str_prop_2    varchar2(512) null,
    str_prop_3    varchar2(512) null,
    int_prop_1    number(10) null,
    int_prop_2    number(10) null,
    long_prop_1   number(13) null,
    long_prop_2   number(13) null,
    dec_prop_1    numeric(13, 4) null,
    dec_prop_2    numeric(13, 4) null,
    bool_prop_1   varchar2(1) null,
    bool_prop_2   varchar2(1) null,
    constraint qrtz_simprop_trig_pk primary key (sched_name, trigger_name, trigger_group),
    constraint qrtz_simprop_trig_to_trig_fk foreign key (sched_name, trigger_name, trigger_group)
        references qrtz_triggers (sched_name, trigger_name, trigger_group)
);


create index idx_qrtz_j_req_recovery on qrtz_job_details (sched_name, requests_recovery);
create index idx_qrtz_j_grp on qrtz_job_details (sched_name, job_group);

create index idx_qrtz_t_j on qrtz_triggers (sched_name, job_name, job_group);
create index idx_qrtz_t_jg on qrtz_triggers (sched_name, job_group);
create index idx_qrtz_t_c on qrtz_triggers (sched_name, calendar_name);
create index idx_qrtz_t_g on qrtz_triggers (sched_name, trigger_group);
create index idx_qrtz_t_state on qrtz_triggers (sched_name, trigger_state);
create index idx_qrtz_t_n_state on qrtz_triggers (sched_name, trigger_name, trigger_group, trigger_state);
create index idx_qrtz_t_n_g_state on qrtz_triggers (sched_name, trigger_group, trigger_state);
create index idx_qrtz_t_next_fire_time on qrtz_triggers (sched_name, next_fire_time);
create index idx_qrtz_t_nft_st on qrtz_triggers (sched_name, trigger_state, next_fire_time);
create index idx_qrtz_t_nft_misfire on qrtz_triggers (sched_name, misfire_instr, next_fire_time);
create index idx_qrtz_t_nft_st_misfire on qrtz_triggers (sched_name, misfire_instr, next_fire_time, trigger_state);
create index idx_qrtz_t_nft_st_misfire_grp on qrtz_triggers (sched_name, misfire_instr, next_fire_time, trigger_group,
                                                             trigger_state);

create index idx_qrtz_ft_trig_inst_name on qrtz_fired_triggers (sched_name, instance_name);
create index idx_qrtz_ft_inst_job_req_rcvry on qrtz_fired_triggers (sched_name, instance_name, requests_recovery);
create index idx_qrtz_ft_j_g on qrtz_fired_triggers (sched_name, job_name, job_group);
create index idx_qrtz_ft_jg on qrtz_fired_triggers (sched_name, job_group);
create index idx_qrtz_ft_t_g on qrtz_fired_triggers (sched_name, trigger_name, trigger_group);

create index idx_qrtz_ft_tg on qrtz_fired_triggers (sched_name, trigger_group);

commit;


-- 创建序列对象，用于主键自增
CREATE SEQUENCE seq_security_levels
    INCREMENT BY 1
    START WITH 1
    NOMAXVALUE
    NOMINVALUE
    CACHE 20;

-- 创建表结构
CREATE TABLE security_levels (
                                 id                   BIGINT NOT NULL, -- 主键id
                                 level                VARCHAR2(30) DEFAULT NULL, -- 密级等级
                                 staff_level_name     VARCHAR2(255) DEFAULT NULL, -- 人员密级名称
                                 security_level_name  VARCHAR2(30) DEFAULT NULL, -- 密级名称
                                 description          VARCHAR2(500) DEFAULT NULL, -- 密级描述
                                 is_deleted           INT DEFAULT 0, -- 是否删除（0存在，1删除）
                                 create_by            VARCHAR2(64) DEFAULT '', -- 创建者
                                 create_time          DATETIME DEFAULT NULL, -- 创建时间
                                 update_by            VARCHAR2(64) DEFAULT '', -- 更新者
                                 update_time          DATETIME DEFAULT NULL -- 更新时间
);

-- 添加主键约束
ALTER TABLE security_levels ADD CONSTRAINT pk_security_levels PRIMARY KEY (id);

-- 添加注释
COMMENT ON TABLE security_levels IS '密级表';
COMMENT ON COLUMN security_levels.id IS '主键id';
COMMENT ON COLUMN security_levels.level IS '密级等级';
COMMENT ON COLUMN security_levels.staff_level_name IS '人员密级名称';
COMMENT ON COLUMN security_levels.security_level_name IS '密级名称';
COMMENT ON COLUMN security_levels.description IS '密级描述';
COMMENT ON COLUMN security_levels.is_deleted IS '是否删除（0存在，1删除）';
COMMENT ON COLUMN security_levels.create_by IS '创建者';
COMMENT ON COLUMN security_levels.create_time IS '创建时间';
COMMENT ON COLUMN security_levels.update_by IS '更新者';
COMMENT ON COLUMN security_levels.update_time IS '更新时间';


-- 插入第一条记录
INSERT INTO security_levels (
    id, level, staff_level_name, security_level_name, description,
    is_deleted, create_by, create_time, update_by, update_time
) VALUES (
             seq_security_levels.nextval, '0', '', '非密', NULL, 0, '', NULL, '', NULL
         );

-- 插入第二条记录
INSERT INTO security_levels (
    id, level, staff_level_name, security_level_name, description,
    is_deleted, create_by, create_time, update_by, update_time
) VALUES (
             seq_security_levels.nextval, '1', '非涉密人员', '内部', NULL, 0, '', NULL, '', NULL
         );

-- 插入第三条记录
INSERT INTO security_levels (
    id, level, staff_level_name, security_level_name, description,
    is_deleted, create_by, create_time, update_by, update_time
) VALUES (
             seq_security_levels.nextval, '2', '一般涉密人员', '秘密', NULL, 0, '', NULL, '', NULL
         );

-- 插入第四条记录
INSERT INTO security_levels (
    id, level, staff_level_name, security_level_name, description,
    is_deleted, create_by, create_time, update_by, update_time
) VALUES (
             seq_security_levels.nextval, '3', '重要涉密人员', '机密', NULL, 0, '', NULL, '', NULL
         );

-- 插入第五条记录
INSERT INTO security_levels (
    id, level, staff_level_name, security_level_name, description,
    is_deleted, create_by, create_time, update_by, update_time
) VALUES (
             seq_security_levels.nextval, '4', '核心涉密人员', '绝密', NULL, 0, '', NULL, '', NULL
         );


-- 创建序列对象，用于主键自增
CREATE SEQUENCE seq_security_points
    INCREMENT BY 1
    START WITH 1
    NOMAXVALUE
    NOMINVALUE
    CACHE 20;

-- 创建表结构
CREATE TABLE security_points (
                                 id                 BIGINT NOT NULL, -- 主键id
                                 security_level_id  INT DEFAULT NULL, -- 密级id
                                 security_point_name VARCHAR2(30) DEFAULT NULL, -- 密点名称
                                 rule_name          INT DEFAULT NULL, -- 规则名称
                                 rule_value         VARCHAR2(255) DEFAULT NULL, -- 规则值
                                 description        VARCHAR2(255) DEFAULT NULL, -- 密点描述
                                 is_deleted         INT DEFAULT 0, -- 是否删除（0存在，1删除）
                                 create_by          VARCHAR2(64) DEFAULT '', -- 创建者
                                 create_time        DATETIME DEFAULT NULL, -- 创建时间
                                 update_by          VARCHAR2(64) DEFAULT '', -- 更新者
                                 update_time        DATETIME DEFAULT NULL -- 更新时间
);

-- 添加主键约束
ALTER TABLE security_points ADD CONSTRAINT pk_security_points PRIMARY KEY (id);

-- 添加注释
COMMENT ON TABLE security_points IS '密点表';
COMMENT ON COLUMN security_points.id IS '主键id';
COMMENT ON COLUMN security_points.security_level_id IS '密级id';
COMMENT ON COLUMN security_points.security_point_name IS '密点名称';
COMMENT ON COLUMN security_points.rule_name IS '规则名称';
COMMENT ON COLUMN security_points.rule_value IS '规则值';
COMMENT ON COLUMN security_points.description IS '密点描述';
COMMENT ON COLUMN security_points.is_deleted IS '是否删除（0存在，1删除）';
COMMENT ON COLUMN security_points.create_by IS '创建者';
COMMENT ON COLUMN security_points.create_time IS '创建时间';
COMMENT ON COLUMN security_points.update_by IS '更新者';
COMMENT ON COLUMN security_points.update_time IS '更新时间';


-- 创建表结构
CREATE TABLE security_points_relation (
                                          property_id      VARCHAR2(50) DEFAULT NULL, -- 资产id
                                          property_type    VARCHAR2(50) DEFAULT NULL, -- 资产类型
                                          security_point_id INT DEFAULT NULL, -- 密点id
                                          table_name       VARCHAR2(255) DEFAULT NULL, -- 表名
                                          col_name         VARCHAR2(255) DEFAULT NULL, -- 字段名
                                          col_desc         VARCHAR2(255) DEFAULT NULL -- 字段描述
);

-- 添加注释
COMMENT ON TABLE security_points_relation IS '密点关联表';
COMMENT ON COLUMN security_points_relation.property_id IS '资产id';
COMMENT ON COLUMN security_points_relation.property_type IS '资产类型';
COMMENT ON COLUMN security_points_relation.security_point_id IS '密点id';
COMMENT ON COLUMN security_points_relation.table_name IS '表名';
COMMENT ON COLUMN security_points_relation.col_name IS '字段名';
COMMENT ON COLUMN security_points_relation.col_desc IS '字段描述';


-- 创建序列对象，用于主键自增
CREATE SEQUENCE seq_subscribe_info
    INCREMENT BY 1
    START WITH 1
    NOMAXVALUE
    NOMINVALUE
    CACHE 20;

-- 创建表结构
CREATE TABLE subscribe_info (
                                id               INT NOT NULL, -- 主键id
                                user_id          INT DEFAULT NULL, -- 用户id
                                property_type    VARCHAR2(50) DEFAULT NULL, -- 资产类型
                                operation_type   INT DEFAULT NULL, -- 操作类型(1新增 2修改 3删除)
                                before_change    CLOB DEFAULT NULL, -- 修改前数据
                                after_change     CLOB DEFAULT NULL, -- 修改后数据
                                notice_info      VARCHAR2(50) DEFAULT NULL, -- 通知信息
                                read_status      INT DEFAULT 1, -- 已读状态（0已读，1未读）
                                is_deleted       INT DEFAULT 0, -- 是否删除（0存在，1删除）
                                create_by        VARCHAR2(32) DEFAULT NULL, -- 创建人
                                create_time      DATETIME DEFAULT NULL, -- 创建时间
                                update_by        VARCHAR2(32) DEFAULT NULL, -- 修改人
                                update_time      DATETIME DEFAULT NULL -- 修改时间
);

-- 添加主键约束
ALTER TABLE subscribe_info ADD CONSTRAINT pk_subscribe_info PRIMARY KEY (id);

-- 添加注释
COMMENT ON TABLE subscribe_info IS '订阅信息表';
COMMENT ON COLUMN subscribe_info.id IS '主键id';
COMMENT ON COLUMN subscribe_info.user_id IS '用户id';
COMMENT ON COLUMN subscribe_info.property_type IS '资产类型';
COMMENT ON COLUMN subscribe_info.operation_type IS '操作类型(1新增 2修改 3删除)';
COMMENT ON COLUMN subscribe_info.before_change IS '修改前数据';
COMMENT ON COLUMN subscribe_info.after_change IS '修改后数据';
COMMENT ON COLUMN subscribe_info.notice_info IS '通知信息';
COMMENT ON COLUMN subscribe_info.read_status IS '已读状态（0已读，1未读）';
COMMENT ON COLUMN subscribe_info.is_deleted IS '是否删除（0存在，1删除）';
COMMENT ON COLUMN subscribe_info.create_by IS '创建人';
COMMENT ON COLUMN subscribe_info.create_time IS '创建时间';
COMMENT ON COLUMN subscribe_info.update_by IS '修改人';
COMMENT ON COLUMN subscribe_info.update_time IS '修改时间';


-- 创建表结构
CREATE TABLE user_subscribe_record (
                                       user_id       INT DEFAULT NULL, -- 用户id
                                       property_id   VARCHAR2(50) DEFAULT NULL, -- 资产id
                                       property_type VARCHAR2(50) DEFAULT NULL -- 资产类型
);

-- 添加注释
COMMENT ON TABLE user_subscribe_record IS '用户订阅记录表';
COMMENT ON COLUMN user_subscribe_record.user_id IS '用户id';
COMMENT ON COLUMN user_subscribe_record.property_id IS '资产id';
COMMENT ON COLUMN user_subscribe_record.property_type IS '资产类型';


-- 创建序列对象，用于主键自增
CREATE SEQUENCE seq_sys_config
    INCREMENT BY 1
    START WITH 1
    NOMAXVALUE
    NOMINVALUE
    CACHE 20;

-- 创建表结构
CREATE TABLE sys_config (
                            config_id     INT NOT NULL, -- 参数主键
                            config_name   VARCHAR2(100) DEFAULT '' COMMENT '参数名称', -- 参数名称
                            config_key    VARCHAR2(100) DEFAULT '' COMMENT '参数键名', -- 参数键名
                            config_value  VARCHAR2(500) DEFAULT '' COMMENT '参数键值', -- 参数键值
                            config_type   CHAR(1) DEFAULT 'N' COMMENT '系统内置（Y是 N否）', -- 系统内置（Y是 N否）
                            create_by     VARCHAR2(64) DEFAULT '' COMMENT '创建者', -- 创建者
                            create_time   DATETIME DEFAULT NULL COMMENT '创建时间', -- 创建时间
                            update_by     VARCHAR2(64) DEFAULT '' COMMENT '更新者', -- 更新者
                            update_time   DATETIME DEFAULT NULL COMMENT '更新时间', -- 更新时间
                            remark        VARCHAR2(500) DEFAULT NULL COMMENT '备注' -- 备注
);

-- 添加主键约束
ALTER TABLE sys_config ADD CONSTRAINT pk_sys_config PRIMARY KEY (config_id);

-- 添加注释
COMMENT ON TABLE sys_config IS '参数配置表';
COMMENT ON COLUMN sys_config.config_id IS '参数主键';
COMMENT ON COLUMN sys_config.config_name IS '参数名称';
COMMENT ON COLUMN sys_config.config_key IS '参数键名';
COMMENT ON COLUMN sys_config.config_value IS '参数键值';
COMMENT ON COLUMN sys_config.config_type IS '系统内置（Y是 N否）';
COMMENT ON COLUMN sys_config.create_by IS '创建者';
COMMENT ON COLUMN sys_config.create_time IS '创建时间';
COMMENT ON COLUMN sys_config.update_by IS '更新者';
COMMENT ON COLUMN sys_config.update_time IS '更新时间';
COMMENT ON COLUMN sys_config.remark IS '备注';


-- 插入第一条记录
INSERT INTO sys_config (
    config_id, config_name, config_key, config_value, config_type,
    create_by, create_time, update_by, update_time, remark
) VALUES (
             seq_sys_config.nextval, '主框架页-默认皮肤样式名称', 'sys.index.skinName', 'skin-blue', 'Y',
             'admin', TO_DATE('2024-08-05 17:10:10', 'YYYY-MM-DD HH24:MI:SS'), '',
             NULL, '蓝色 skin-blue、绿色 skin-green、紫色 skin-purple、红色 skin-red、黄色 skin-yellow'
         );

-- 插入第二条记录
INSERT INTO sys_config (
    config_id, config_name, config_key, config_value, config_type,
    create_by, create_time, update_by, update_time, remark
) VALUES (
             seq_sys_config.nextval, '用户管理-账号初始密码', 'sys.user.initPassword', '123456', 'Y',
             'admin', TO_DATE('2024-08-05 17:10:10', 'YYYY-MM-DD HH24:MI:SS'), '',
             NULL, '初始化密码 123456'
         );

-- 插入第三条记录
INSERT INTO sys_config (
    config_id, config_name, config_key, config_value, config_type,
    create_by, create_time, update_by, update_time, remark
) VALUES (
             seq_sys_config.nextval, '主框架页-侧边栏主题', 'sys.index.sideTheme', 'theme-light', 'Y',
             'admin', TO_DATE('2024-08-05 17:10:10', 'YYYY-MM-DD HH24:MI:SS'), 'admin',
             TO_DATE('2024-08-19 17:13:03', 'YYYY-MM-DD HH24:MI:SS'), '深色主题theme-dark，浅色主题theme-light'
         );

-- 插入第四条记录
INSERT INTO sys_config (
    config_id, config_name, config_key, config_value, config_type,
    create_by, create_time, update_by, update_time, remark
) VALUES (
             seq_sys_config.nextval, '账号自助-验证码开关', 'sys.account.captchaEnabled', 'false', 'Y',
             'admin', TO_DATE('2024-08-05 17:10:10', 'YYYY-MM-DD HH24:MI:SS'), 'admin',
             TO_DATE('2024-11-01 12:30:18', 'YYYY-MM-DD HH24:MI:SS'), '是否开启验证码功能（true开启，false关闭）'
         );

-- 插入第五条记录
INSERT INTO sys_config (
    config_id, config_name, config_key, config_value, config_type,
    create_by, create_time, update_by, update_time, remark
) VALUES (
             seq_sys_config.nextval, '账号自助-是否开启用户注册功能', 'sys.account.registerUser', 'false', 'Y',
             'admin', TO_DATE('2024-08-05 17:10:10', 'YYYY-MM-DD HH24:MI:SS'), '',
             NULL, '是否开启注册用户功能（true开启，false关闭）'
         );

-- 插入第六条记录
INSERT INTO sys_config (
    config_id, config_name, config_key, config_value, config_type,
    create_by, create_time, update_by, update_time, remark
) VALUES (
             seq_sys_config.nextval, '用户登录-黑名单列表', 'sys.login.blackIPList', '', 'Y',
             'admin', TO_DATE('2024-08-05 17:10:10', 'YYYY-MM-DD HH24:MI:SS'), '',
             NULL, '设置登录IP黑名单限制，多个匹配项以;分隔，支持匹配（*通配、网段）'
         );

-- 创建序列对象，用于主键自增
CREATE SEQUENCE seq_sys_dict_data
    INCREMENT BY 1
    START WITH 1
    NOMAXVALUE
    NOMINVALUE
    CACHE 20;

-- 创建表结构
CREATE TABLE sys_dict_data (
                               dict_code   BIGINT NOT NULL, -- 字典编码
                               dict_sort   INT DEFAULT 0, -- 字典排序
                               dict_label  VARCHAR2(100) DEFAULT '', -- 字典标签
                               dict_value  VARCHAR2(100) DEFAULT '', -- 字典键值
                               dict_type   VARCHAR2(100) DEFAULT '', -- 字典类型
                               css_class   VARCHAR2(100) DEFAULT NULL, -- 样式属性（其他样式扩展）
                               list_class  VARCHAR2(100) DEFAULT NULL, -- 表格回显样式
                               is_default  CHAR(1) DEFAULT 'N', -- 是否默认（Y是 N否）
                               status      CHAR(1) DEFAULT '0', -- 状态（0正常 1停用）
                               create_by   VARCHAR2(64) DEFAULT '', -- 创建者
                               create_time DATETIME DEFAULT NULL, -- 创建时间
                               update_by   VARCHAR2(64) DEFAULT '', -- 更新者
                               update_time DATETIME DEFAULT NULL, -- 更新时间
                               remark      VARCHAR2(500) DEFAULT NULL -- 备注
);

-- 添加主键约束
ALTER TABLE sys_dict_data ADD CONSTRAINT pk_sys_dict_data PRIMARY KEY (dict_code);

-- 添加注释
COMMENT ON TABLE sys_dict_data IS '字典数据表';
COMMENT ON COLUMN sys_dict_data.dict_code IS '字典编码';
COMMENT ON COLUMN sys_dict_data.dict_sort IS '字典排序';
COMMENT ON COLUMN sys_dict_data.dict_label IS '字典标签';
COMMENT ON COLUMN sys_dict_data.dict_value IS '字典键值';
COMMENT ON COLUMN sys_dict_data.dict_type IS '字典类型';
COMMENT ON COLUMN sys_dict_data.css_class IS '样式属性（其他样式扩展）';
COMMENT ON COLUMN sys_dict_data.list_class IS '表格回显样式';
COMMENT ON COLUMN sys_dict_data.is_default IS '是否默认（Y是 N否）';
COMMENT ON COLUMN sys_dict_data.status IS '状态（0正常 1停用）';
COMMENT ON COLUMN sys_dict_data.create_by IS '创建者';
COMMENT ON COLUMN sys_dict_data.create_time IS '创建时间';
COMMENT ON COLUMN sys_dict_data.update_by IS '更新者';
COMMENT ON COLUMN sys_dict_data.update_time IS '更新时间';
COMMENT ON COLUMN sys_dict_data.remark IS '备注';

INSERT INTO sys_dict_data VALUES (1, 1, '男', '0', 'sys_user_sex', '', '', 'Y', '0', 'admin', NULL, '', NULL, '性别男');
INSERT INTO sys_dict_data VALUES (2, 2, '女', '1', 'sys_user_sex', '', '', 'N', '0', 'admin', NULL, '', NULL, '性别女');
INSERT INTO sys_dict_data VALUES (3, 3, '未知', '2', 'sys_user_sex', '', '', 'N', '0', 'admin', NULL, '', NULL, '性别未知');
INSERT INTO sys_dict_data VALUES (4, 1, '显示', '0', 'sys_show_hide', '', 'primary', 'Y', '0', 'admin', NULL, '', NULL, '显示菜单');
INSERT INTO sys_dict_data VALUES (5, 2, '隐藏', '1', 'sys_show_hide', '', 'danger', 'N', '0', 'admin', NULL, '', NULL, '隐藏菜单');
INSERT INTO sys_dict_data VALUES (6, 1, '正常', '0', 'sys_normal_disable', '', 'primary', 'Y', '0', 'admin', NULL, '', NULL, '正常状态');
INSERT INTO sys_dict_data VALUES (7, 2, '停用', '1', 'sys_normal_disable', '', 'danger', 'N', '0', 'admin', NULL, '', NULL, '停用状态');
INSERT INTO sys_dict_data VALUES (8, 1, '正常', '0', 'sys_job_status', '', 'primary', 'Y', '0', 'admin', NULL, '', NULL, '正常状态');
INSERT INTO sys_dict_data VALUES (9, 2, '暂停', '1', 'sys_job_status', '', 'danger', 'N', '0', 'admin', NULL, '', NULL, '停用状态');
INSERT INTO sys_dict_data VALUES (10, 1, '默认', 'DEFAULT', 'sys_job_group', '', '', 'Y', '0', 'admin', NULL, '', NULL, '默认分组');
INSERT INTO sys_dict_data VALUES (11, 2, '系统', 'SYSTEM', 'sys_job_group', '', '', 'N', '0', 'admin', NULL, '', NULL, '系统分组');
INSERT INTO sys_dict_data VALUES (12, 1, '是', 'Y', 'sys_yes_no', '', 'primary', 'Y', '0', 'admin', NULL, '', NULL, '系统默认是');
INSERT INTO sys_dict_data VALUES (13, 2, '否', 'N', 'sys_yes_no', '', 'danger', 'N', '0', 'admin', NULL, '', NULL, '系统默认否');
INSERT INTO sys_dict_data VALUES (14, 1, '通知', '1', 'sys_notice_type', '', 'warning', 'Y', '0', 'admin', NULL, '', NULL, '通知');
INSERT INTO sys_dict_data VALUES (15, 2, '公告', '2', 'sys_notice_type', '', 'success', 'N', '0', 'admin', NULL, '', NULL, '公告');
INSERT INTO sys_dict_data VALUES (16, 1, '正常', '0', 'sys_notice_status', '', 'primary', 'Y', '0', 'admin', NULL, '', NULL, '正常状态');
INSERT INTO sys_dict_data VALUES (17, 2, '关闭', '1', 'sys_notice_status', '', 'danger', 'N', '0', 'admin', NULL, '', NULL, '关闭状态');
INSERT INTO sys_dict_data VALUES (18, 99, '其他', '0', 'sys_oper_type', '', 'info', 'N', '0', 'admin', NULL, '', NULL, '其他操作');
INSERT INTO sys_dict_data VALUES (19, 1, '新增', '1', 'sys_oper_type', '', 'info', 'N', '0', 'admin', NULL, '', NULL, '新增操作');
INSERT INTO sys_dict_data VALUES (20, 2, '修改', '2', 'sys_oper_type', '', 'info', 'N', '0', 'admin', NULL, '', NULL, '修改操作');
INSERT INTO sys_dict_data VALUES (21, 3, '删除', '3', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', NULL, '', NULL, '删除操作');
INSERT INTO sys_dict_data VALUES (22, 4, '授权', '4', 'sys_oper_type', '', 'primary', 'N', '0', 'admin', NULL, '', NULL, '授权操作');
INSERT INTO sys_dict_data VALUES (23, 5, '导出', '5', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', NULL, '', NULL, '导出操作');
INSERT INTO sys_dict_data VALUES (24, 6, '导入', '6', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', NULL, '', NULL, '导入操作');
INSERT INTO sys_dict_data VALUES (25, 7, '强退', '7', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', NULL, '', NULL, '强退操作');
INSERT INTO sys_dict_data VALUES (26, 8, '生成代码', '8', 'sys_oper_type', '', 'warning', 'N', '0', 'admin', NULL, '', NULL, '生成操作');
INSERT INTO sys_dict_data VALUES (27, 9, '清空数据', '9', 'sys_oper_type', '', 'danger', 'N', '0', 'admin', NULL, '', NULL, '清空操作');
INSERT INTO sys_dict_data VALUES (28, 1, '成功', '0', 'sys_common_status', '', 'primary', 'N', '0', 'admin', NULL, '', NULL, '正常状态');
INSERT INTO sys_dict_data VALUES (29, 2, '失败', '1', 'sys_common_status', '', 'danger', 'N', '0', 'admin', NULL, '', NULL, '停用状态');
INSERT INTO sys_dict_data VALUES (100, 0, '主菜单', '0', 'sys_menu_category', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (101, 0, '离线应用详情菜单', '1', 'sys_menu_category', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (102, 0, '数据服务应用详情菜单', '2', 'sys_menu_category', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (103, 0, '原生指标', '原生指标', 'indicator_type', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (104, 0, '洐生指标', '洐生指标', 'indicator_type', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (105, 0, '复合指标', '复合指标', 'indicator_type', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (106, 0, '指标新增', 'indicator-1', 'subscribe_type', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (107, 0, '指标修改', 'indicator-2', 'subscribe_type', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (108, 0, '指标删除', 'indicator-3', 'subscribe_type', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (109, 0, '新增指标\"%std-name%\"', '1', 'subscribe_cnt', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (110, 0, '非密', '0', 'available_security_level', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (111, 1, '内部', '1', 'available_security_level', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (112, 2, '秘密', '2', 'available_security_level', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (113, 3, '机密', '3', 'available_security_level', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (114, 4, '绝密', '4', 'available_security_level', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (118, 0, '当年累计值', '当年累计值', 'indicator_value_type', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (119, 0, '当月累计值', '当月累计值', 'indicator_value_type', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (120, 0, '当周累计值', '当周累计值', 'indicator_value_type', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (121, 0, '当日累计值', '当日累计值', 'indicator_value_type', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (122, 0, '每日', '每日', 'report_frequency', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (123, 0, '周度', '周度', 'report_frequency', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (124, 0, '月度', '月度', 'report_frequency', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (125, 0, '年度', '年度', 'report_frequency', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (126, 0, '集团', '集团', 'application_dimension', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (127, 0, '工房', '工房', 'application_dimension', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (128, 0, '分厂', '分厂', 'application_dimension', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (131, 1, '仓储物流管理系统', '仓储物流管理系统', 'application_system', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (132, 2, '车间监视及显示系统', '车间监视及显示系统', 'application_system', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (133, 3, '生产可视化管控系统', '生产可视化管控系统', 'application_system', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (134, 4, '数据资产管理系统', '数据资产管理系统', 'application_system', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (135, 5, '计划物资系统', '计划物资系统', 'application_system', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (136, 6, 'MES', 'MES', 'application_system', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (137, 7, '主数据管理系统', '主数据管理系统', 'application_system', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (138, 0, '仓储物流管理系统', '仓储物流管理系统', 'data_source', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (139, 1, '车间监视及显示系统', '车间监视及显示系统', 'data_source', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (140, 2, '生产可视化管控系统', '生产可视化管控系统', 'data_source', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (141, 3, '数据资产管理系统', '数据资产管理系统', 'data_source', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (142, 4, '计划物资系统', '计划物资系统', 'data_source', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (143, 5, 'MES', 'MES', 'data_source', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (144, 6, '主数据管理系统', '主数据管理系统', 'data_source', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (145, 0, '待审核', '1', 'transfer_status', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (146, 0, '拒绝', '2', 'transfer_status', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (147, 0, '通过', '3', 'transfer_status', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (148, 0, '表标签', '表标签', 'tag_category', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (149, 0, '字段标签', '字段标签', 'tag_category', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (150, 0, '正常', '0', 'tag_status', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (151, 0, '停用', '1', 'tag_status', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (155, 0, 'ODS数据准备层', 'ODS数据准备层', 'security_model_level', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (156, 1, 'DWD数据明细层', 'DWD数据明细层', 'security_model_level', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (157, 2, 'DWS数据汇总层', 'DWS数据汇总层', 'security_model_level', NULL, 'default', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (158, 3, 'DM数据集市层', 'DM数据集市层', 'security_model_level', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (159, 4, 'ST数据应用层', 'ST数据应用层', 'security_model_level', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (160, 5, '其他数据库表', '其他数据库表', 'security_model_level', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (161, 0, '元数据新增', 'metadata-1', 'subscribe_type', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (162, 0, '元数据修改', 'metadata-2', 'subscribe_type', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (163, 0, '元数据删除', 'metadata-3', 'subscribe_type', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (164, 0, '非涉密人员', '1', 'staff_level', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (165, 0, '一般涉密人员', '2', 'staff_level', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (166, 0, '重要涉密人员', '3', 'staff_level', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (167, 0, '核心涉密人员', '4', 'staff_level', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (168, 0, '数据替换规则', '1', 'security_point_rule', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (169, 0, '密级规则', '2', 'security_point_rule', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (170, 0, '审核拒绝', '0', 'cross_network_transfer_status', NULL, 'danger', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (171, 0, '审核通过', '1', 'cross_network_transfer_status', NULL, 'success', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (172, 0, '待审核', '2', 'cross_network_transfer_status', NULL, 'warning', 'N', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_data VALUES (173, 0, '撤回', '3', 'cross_network_transfer_status', NULL, 'info', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (174, 0, '涉密网数据导出', '1', 'cross_network_transfer_type', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_data VALUES (175, 0, '工控网数据导出', '2', 'cross_network_transfer_type', NULL, 'default', 'N', '0', 'admin', NULL, '', NULL, NULL);


-- 创建序列对象，用于主键自增
CREATE SEQUENCE seq_sys_dict_type
    INCREMENT BY 1
    START WITH 1
    NOMAXVALUE
    NOMINVALUE
    CACHE 20;

-- 创建表结构
CREATE TABLE sys_dict_type (
                               dict_id     BIGINT NOT NULL, -- 字典主键
                               dict_name   VARCHAR2(100) DEFAULT '', -- 字典名称
                               dict_type   VARCHAR2(100) DEFAULT '', -- 字典类型
                               status      CHAR(1) DEFAULT '0', -- 状态（0正常 1停用）
                               create_by   VARCHAR2(64) DEFAULT '', -- 创建者
                               create_time DATETIME DEFAULT NULL, -- 创建时间
                               update_by   VARCHAR2(64) DEFAULT '', -- 更新者
                               update_time DATETIME DEFAULT NULL, -- 更新时间
                               remark      VARCHAR2(500) DEFAULT NULL -- 备注
);

-- 添加主键约束
ALTER TABLE sys_dict_type ADD CONSTRAINT pk_sys_dict_type PRIMARY KEY (dict_id);

-- 添加唯一约束
ALTER TABLE sys_dict_type ADD CONSTRAINT uk_sys_dict_type UNIQUE (dict_type);

-- 添加注释
COMMENT ON TABLE sys_dict_type IS '字典类型表';
COMMENT ON COLUMN sys_dict_type.dict_id IS '字典主键';
COMMENT ON COLUMN sys_dict_type.dict_name IS '字典名称';
COMMENT ON COLUMN sys_dict_type.dict_type IS '字典类型';
COMMENT ON COLUMN sys_dict_type.status IS '状态（0正常 1停用）';
COMMENT ON COLUMN sys_dict_type.create_by IS '创建者';
COMMENT ON COLUMN sys_dict_type.create_time IS '创建时间';
COMMENT ON COLUMN sys_dict_type.update_by IS '更新者';
COMMENT ON COLUMN sys_dict_type.update_time IS '更新时间';
COMMENT ON COLUMN sys_dict_type.remark IS '备注';


INSERT INTO sys_dict_type VALUES (1, '用户性别', 'sys_user_sex', '0', 'admin', NULL, '', NULL, '用户性别列表');
INSERT INTO sys_dict_type VALUES (2, '菜单状态', 'sys_show_hide', '0', 'admin', NULL, '', NULL, '菜单状态列表');
INSERT INTO sys_dict_type VALUES (3, '系统开关', 'sys_normal_disable', '0', 'admin', NULL, '', NULL, '系统开关列表');
INSERT INTO sys_dict_type VALUES (4, '任务状态', 'sys_job_status', '0', 'admin', NULL, '', NULL, '任务状态列表');
INSERT INTO sys_dict_type VALUES (5, '任务分组', 'sys_job_group', '0', 'admin', NULL, '', NULL, '任务分组列表');
INSERT INTO sys_dict_type VALUES (6, '系统是否', 'sys_yes_no', '0', 'admin', NULL, '', NULL, '系统是否列表');
INSERT INTO sys_dict_type VALUES (7, '通知类型', 'sys_notice_type', '0', 'admin', NULL, '', NULL, '通知类型列表');
INSERT INTO sys_dict_type VALUES (8, '通知状态', 'sys_notice_status', '0', 'admin', NULL, '', NULL, '通知状态列表');
INSERT INTO sys_dict_type VALUES (9, '操作类型', 'sys_oper_type', '0', 'admin', NULL, '', NULL, '操作类型列表');
INSERT INTO sys_dict_type VALUES (10, '系统状态', 'sys_common_status', '0', 'admin', NULL, '', NULL, '登录状态列表');
INSERT INTO sys_dict_type VALUES (100, '菜单分类', 'sys_menu_category', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_type VALUES (101, '指标类型', 'indicator_type', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_type VALUES (102, '订阅消息类型', 'subscribe_type', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_type VALUES (103, '订阅消息内容', 'subscribe_cnt', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_type VALUES (104, '指标值类型', 'indicator_value_type', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_type VALUES (105, '数据密级', 'available_security_level', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_type VALUES (106, '报告频度', 'report_frequency', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_type VALUES (107, '应用维度', 'application_dimension', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_type VALUES (108, '应用系统', 'application_system', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_type VALUES (110, '数据来源', 'data_source', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_type VALUES (111, '跨网传输审核状态', 'cross_network_transfer_status', '0', 'admin', NULL, 'admin', NULL, NULL);
INSERT INTO sys_dict_type VALUES (112, '标签分类', 'tag_category', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_type VALUES (113, '标签状态', 'tag_status', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_type VALUES (114, '数据层级', 'security_model_level', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_type VALUES (115, '人员密级', 'staff_level', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_type VALUES (116, '密点规则', 'security_point_rule', '0', 'admin', NULL, '', NULL, NULL);
INSERT INTO sys_dict_type VALUES (117, '跨网传输类型', 'cross_network_transfer_type', '0', 'admin', NULL, '', NULL, NULL);


-- 创建序列对象，用于主键自增
CREATE SEQUENCE seq_sys_job
    INCREMENT BY 1
    START WITH 1
    NOMAXVALUE
    NOMINVALUE
    CACHE 20;

-- 创建 sys_job 表
CREATE TABLE sys_job (
                         job_id         BIGINT NOT NULL, -- 任务ID
                         job_name       VARCHAR2(64) NOT NULL DEFAULT '', -- 任务名称
                         job_group      VARCHAR2(64) NOT NULL DEFAULT 'DEFAULT', -- 任务组名
                         invoke_target  VARCHAR2(500) NOT NULL, -- 调用目标字符串
                         cron_expression VARCHAR2(255) DEFAULT '', -- cron执行表达式
                         misfire_policy VARCHAR2(20) DEFAULT '3', -- 计划执行错误策略（1立即执行 2执行一次 3放弃执行）
                         concurrent     CHAR(1) DEFAULT '1', -- 是否并发执行（0允许 1禁止）
                         status         CHAR(1) DEFAULT '0', -- 状态（0正常 1暂停）
                         create_by      VARCHAR2(64) DEFAULT '', -- 创建者
                         create_time    DATETIME DEFAULT NULL, -- 创建时间
                         update_by      VARCHAR2(64) DEFAULT '', -- 更新者
                         update_time    DATETIME DEFAULT NULL, -- 更新时间
                         remark         VARCHAR2(500) DEFAULT '' -- 备注信息
);

-- 添加主键约束
ALTER TABLE sys_job ADD CONSTRAINT pk_sys_job PRIMARY KEY (job_id, job_name, job_group);

-- 添加注释
COMMENT ON TABLE sys_job IS '定时任务调度表';
COMMENT ON COLUMN sys_job.job_id IS '任务ID';
COMMENT ON COLUMN sys_job.job_name IS '任务名称';
COMMENT ON COLUMN sys_job.job_group IS '任务组名';
COMMENT ON COLUMN sys_job.invoke_target IS '调用目标字符串';
COMMENT ON COLUMN sys_job.cron_expression IS 'cron执行表达式';
COMMENT ON COLUMN sys_job.misfire_policy IS '计划执行错误策略（1立即执行 2执行一次 3放弃执行）';
COMMENT ON COLUMN sys_job.concurrent IS '是否并发执行（0允许 1禁止）';
COMMENT ON COLUMN sys_job.status IS '状态（0正常 1暂停）';
COMMENT ON COLUMN sys_job.create_by IS '创建者';
COMMENT ON COLUMN sys_job.create_time IS '创建时间';
COMMENT ON COLUMN sys_job.update_by IS '更新者';
COMMENT ON COLUMN sys_job.update_time IS '更新时间';
COMMENT ON COLUMN sys_job.remark IS '备注信息';

-- 创建序列对象，用于主键自增
CREATE SEQUENCE seq_sys_job_log
    INCREMENT BY 1
    START WITH 1
    NOMAXVALUE
    NOMINVALUE
    CACHE 20;

-- 创建 sys_job_log 表
CREATE TABLE sys_job_log (
                             job_log_id     BIGINT NOT NULL, -- 任务日志ID
                             job_name       VARCHAR2(64) NOT NULL, -- 任务名称
                             job_group      VARCHAR2(64) NOT NULL, -- 任务组名
                             invoke_target  VARCHAR2(500) NOT NULL, -- 调用目标字符串
                             job_message    VARCHAR2(500) DEFAULT NULL, -- 日志信息
                             status         CHAR(1) DEFAULT '0', -- 执行状态（0正常 1失败）
                             exception_info VARCHAR2(2000) DEFAULT '', -- 异常信息
                             create_time    DATETIME DEFAULT NULL -- 创建时间
);

-- 添加主键约束
ALTER TABLE sys_job_log ADD CONSTRAINT pk_sys_job_log PRIMARY KEY (job_log_id);

-- 添加注释
COMMENT ON TABLE sys_job_log IS '定时任务调度日志表';
COMMENT ON COLUMN sys_job_log.job_log_id IS '任务日志ID';
COMMENT ON COLUMN sys_job_log.job_name IS '任务名称';
COMMENT ON COLUMN sys_job_log.job_group IS '任务组名';
COMMENT ON COLUMN sys_job_log.invoke_target IS '调用目标字符串';
COMMENT ON COLUMN sys_job_log.job_message IS '日志信息';
COMMENT ON COLUMN sys_job_log.status IS '执行状态（0正常 1失败）';
COMMENT ON COLUMN sys_job_log.exception_info IS '异常信息';
COMMENT ON COLUMN sys_job_log.create_time IS '创建时间';


-- 创建序列对象，用于主键自增
CREATE SEQUENCE seq_sys_logininfor
    INCREMENT BY 1
    START WITH 1
    NOMAXVALUE
    NOMINVALUE
    CACHE 20;

-- 创建 sys_logininfor 表
CREATE TABLE sys_logininfor (
                                info_id       BIGINT NOT NULL, -- 访问ID
                                user_name     VARCHAR2(50) DEFAULT '', -- 用户账号
                                ipaddr        VARCHAR2(128) DEFAULT '', -- 登录IP地址
                                login_location VARCHAR2(255) DEFAULT '', -- 登录地点
                                browser       VARCHAR2(50) DEFAULT '', -- 浏览器类型
                                os            VARCHAR2(50) DEFAULT '', -- 操作系统
                                status        CHAR(1) DEFAULT '0', -- 登录状态（0成功 1失败）
                                msg           VARCHAR2(255) DEFAULT '', -- 提示消息
                                login_time    DATETIME DEFAULT NULL -- 访问时间
);

-- 添加主键约束
ALTER TABLE sys_logininfor ADD CONSTRAINT pk_sys_logininfor PRIMARY KEY (info_id);

-- 添加索引
CREATE INDEX idx_sys_logininfor_s ON sys_logininfor (status ASC);
CREATE INDEX idx_sys_logininfor_lt ON sys_logininfor (login_time ASC);

-- 添加注释
COMMENT ON TABLE sys_logininfor IS '系统访问记录';
COMMENT ON COLUMN sys_logininfor.info_id IS '访问ID';
COMMENT ON COLUMN sys_logininfor.user_name IS '用户账号';
COMMENT ON COLUMN sys_logininfor.ipaddr IS '登录IP地址';
COMMENT ON COLUMN sys_logininfor.login_location IS '登录地点';
COMMENT ON COLUMN sys_logininfor.browser IS '浏览器类型';
COMMENT ON COLUMN sys_logininfor.os IS '操作系统';
COMMENT ON COLUMN sys_logininfor.status IS '登录状态（0成功 1失败）';
COMMENT ON COLUMN sys_logininfor.msg IS '提示消息';
COMMENT ON COLUMN sys_logininfor.login_time IS '访问时间';


-- 创建序列对象，用于主键自增
CREATE SEQUENCE seq_sys_menu
    INCREMENT BY 1
    START WITH 1
    NOMAXVALUE
    NOMINVALUE
    CACHE 20;

-- 创建 sys_menu 表
CREATE TABLE sys_menu (
                          menu_id       BIGINT NOT NULL, -- 菜单ID
                          menu_name     VARCHAR2(50) NOT NULL, -- 菜单名称
                          parent_id     BIGINT DEFAULT 0, -- 父菜单ID
                          order_num     INT DEFAULT 0, -- 显示顺序
                          path          VARCHAR2(200) DEFAULT '', -- 路由地址
                          component     VARCHAR2(255) DEFAULT NULL, -- 组件路径
                          query         VARCHAR2(255) DEFAULT NULL, -- 路由参数
                          route_name    VARCHAR2(50) DEFAULT '', -- 路由名称
                          is_frame      INT DEFAULT 1, -- 是否为外链（0是 1否）
                          is_cache      INT DEFAULT 0, -- 是否缓存（0缓存 1不缓存）
                          menu_type     CHAR(1) DEFAULT '', -- 菜单类型（M目录 C菜单 F按钮）
                          visible       CHAR(1) DEFAULT '0', -- 菜单状态（0显示 1隐藏）
                          status        CHAR(1) DEFAULT '0', -- 菜单状态（0正常 1停用）
                          perms         VARCHAR2(100) DEFAULT NULL, -- 权限标识
                          icon          VARCHAR2(100) DEFAULT '#', -- 菜单图标
                          create_by     VARCHAR2(64) DEFAULT '', -- 创建者
                          create_time   DATETIME DEFAULT NULL, -- 创建时间
                          update_by     VARCHAR2(64) DEFAULT '', -- 更新者
                          update_time   DATETIME DEFAULT NULL, -- 更新时间
                          remark        VARCHAR2(500) DEFAULT '' -- 备注
);

-- 添加主键约束
ALTER TABLE sys_menu ADD CONSTRAINT pk_sys_menu PRIMARY KEY (menu_id);

-- 添加注释
COMMENT ON TABLE sys_menu IS '菜单权限表';
COMMENT ON COLUMN sys_menu.menu_id IS '菜单ID';
COMMENT ON COLUMN sys_menu.menu_name IS '菜单名称';
COMMENT ON COLUMN sys_menu.parent_id IS '父菜单ID';
COMMENT ON COLUMN sys_menu.order_num IS '显示顺序';
COMMENT ON COLUMN sys_menu.path IS '路由地址';
COMMENT ON COLUMN sys_menu.component IS '组件路径';
COMMENT ON COLUMN sys_menu.query IS '路由参数';
COMMENT ON COLUMN sys_menu.route_name IS '路由名称';
COMMENT ON COLUMN sys_menu.is_frame IS '是否为外链（0是 1否）';
COMMENT ON COLUMN sys_menu.is_cache IS '是否缓存（0缓存 1不缓存）';
COMMENT ON COLUMN sys_menu.menu_type IS '菜单类型（M目录 C菜单 F按钮）';
COMMENT ON COLUMN sys_menu.visible IS '菜单状态（0显示 1隐藏）';
COMMENT ON COLUMN sys_menu.status IS '菜单状态（0正常 1停用）';
COMMENT ON COLUMN sys_menu.perms IS '权限标识';
COMMENT ON COLUMN sys_menu.icon IS '菜单图标';
COMMENT ON COLUMN sys_menu.create_by IS '创建者';
COMMENT ON COLUMN sys_menu.create_time IS '创建时间';
COMMENT ON COLUMN sys_menu.update_by IS '更新者';
COMMENT ON COLUMN sys_menu.update_time IS '更新时间';
COMMENT ON COLUMN sys_menu.remark IS '备注';


INSERT INTO sys_menu VALUES (1, '系统管理', 0, 10, 'system', NULL, '', '', 1, 0, 'M', '0', '0', '', 'system', 'admin', NULL, 'admin', NULL, '系统管理目录');
INSERT INTO sys_menu VALUES (2, '系统监控', 0, 52, 'monitor', NULL, '', '', 1, 0, 'M', '0', '0', '', 'monitor', 'admin', NULL, 'admin', NULL, '系统监控目录');
INSERT INTO sys_menu VALUES (3, '系统工具', 0, 53, 'tool', NULL, '', '', 1, 0, 'M', '0', '0', '', 'tool', 'admin', NULL, 'admin', NULL, '系统工具目录');
INSERT INTO sys_menu VALUES (100, '用户管理', 1, 1, 'user', 'system/user/index', '', '', 1, 0, 'C', '0', '0', 'system:user:list', 'user', 'admin', NULL, '', NULL, '用户管理菜单');
INSERT INTO sys_menu VALUES (101, '角色管理', 1, 2, 'role', 'system/role/index', '', '', 1, 0, 'C', '0', '0', 'system:role:list', 'peoples', 'admin', NULL, '', NULL, '角色管理菜单');
INSERT INTO sys_menu VALUES (102, '菜单管理', 1, 3, 'menu', 'system/menu/index', '', '', 1, 0, 'C', '0', '0', 'system:menu:list', 'tree-table', 'admin', NULL, '', NULL, '菜单管理菜单');
INSERT INTO sys_menu VALUES (103, '部门管理', 1, 4, 'dept', 'system/dept/index', '', '', 1, 0, 'C', '0', '0', 'system:dept:list', 'tree', 'admin', NULL, '', NULL, '部门管理菜单');
INSERT INTO sys_menu VALUES (104, '岗位管理', 1, 5, 'post', 'system/post/index', '', '', 1, 0, 'C', '0', '0', 'system:post:list', 'post', 'admin', NULL, '', NULL, '岗位管理菜单');
INSERT INTO sys_menu VALUES (105, '字典管理', 1, 6, 'dict', 'system/dict/index', '', '', 1, 0, 'C', '0', '0', 'system:dict:list', 'dict', 'admin', NULL, '', NULL, '字典管理菜单');
INSERT INTO sys_menu VALUES (106, '参数设置', 1, 7, 'config', 'system/config/index', '', '', 1, 0, 'C', '0', '0', 'system:config:list', 'edit', 'admin', NULL, '', NULL, '参数设置菜单');
INSERT INTO sys_menu VALUES (107, '通知公告', 1, 8, 'notice', 'system/notice/index', '', '', 1, 0, 'C', '0', '0', 'system:notice:list', 'message', 'admin', NULL, '', NULL, '通知公告菜单');
INSERT INTO sys_menu VALUES (108, '日志管理', 1, 9, 'log', '', '', '', 1, 0, 'M', '0', '0', '', 'log', 'admin', NULL, 'admin', NULL, '日志管理菜单');
INSERT INTO sys_menu VALUES (109, '在线用户', 2, 1, 'online', 'monitor/online/index', '', '', 1, 0, 'C', '0', '0', 'monitor:online:list', 'online', 'admin', NULL, '', NULL, '在线用户菜单');
INSERT INTO sys_menu VALUES (110, '定时任务', 2, 2, 'job', 'monitor/job/index', '', '', 1, 0, 'C', '0', '0', 'monitor:job:list', 'job', 'admin', NULL, '', NULL, '定时任务菜单');
INSERT INTO sys_menu VALUES (111, '数据监控', 2, 3, 'druid', 'monitor/druid/index', '', '', 1, 0, 'C', '0', '0', 'monitor:druid:list', 'druid', 'admin', NULL, '', NULL, '数据监控菜单');
INSERT INTO sys_menu VALUES (112, '服务监控', 2, 4, 'server', 'monitor/server/index', '', '', 1, 0, 'C', '0', '0', 'monitor:server:list', 'server', 'admin', NULL, '', NULL, '服务监控菜单');
INSERT INTO sys_menu VALUES (113, '缓存监控', 2, 5, 'cache', 'monitor/cache/index', '', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis', 'admin', NULL, '', NULL, '缓存监控菜单');
INSERT INTO sys_menu VALUES (114, '缓存列表', 2, 6, 'cacheList', 'monitor/cache/list', '', '', 1, 0, 'C', '0', '0', 'monitor:cache:list', 'redis-list', 'admin', NULL, '', NULL, '缓存列表菜单');
INSERT INTO sys_menu VALUES (115, '表单构建', 3, 1, 'build', 'tool/build/index', '', '', 1, 0, 'C', '0', '0', 'tool:build:list', 'build', 'admin', NULL, '', NULL, '表单构建菜单');
INSERT INTO sys_menu VALUES (116, '代码生成', 3, 2, 'gen', 'tool/gen/index', '', '', 1, 0, 'C', '0', '0', 'tool:gen:list', 'code', 'admin', NULL, 'admin', NULL, '代码生成菜单');
INSERT INTO sys_menu VALUES (117, '系统接口', 3, 3, 'swagger', 'tool/swagger/index', '', '', 1, 0, 'C', '0', '0', 'tool:swagger:list', 'swagger', 'admin', NULL, '', NULL, '系统接口菜单');
INSERT INTO sys_menu VALUES (500, '操作日志', 108, 1, 'operlog', 'monitor/operlog/index', '', '', 1, 0, 'C', '0', '0', 'monitor:operlog:list', 'form', 'admin', NULL, '', NULL, '操作日志菜单');
INSERT INTO sys_menu VALUES (501, '登录日志', 108, 2, 'logininfor', 'monitor/logininfor/index', '', '', 1, 0, 'C', '0', '0', 'monitor:logininfor:list', 'logininfor', 'admin', NULL, '', NULL, '登录日志菜单');
INSERT INTO sys_menu VALUES (1000, '用户查询', 100, 1, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1001, '用户新增', 100, 2, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:add', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1002, '用户修改', 100, 3, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:edit', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1003, '用户删除', 100, 4, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:remove', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1004, '用户导出', 100, 5, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:export', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1005, '用户导入', 100, 6, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:import', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1006, '重置密码', 100, 7, '', '', '', '', 1, 0, 'F', '0', '0', 'system:user:resetPwd', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1007, '角色查询', 101, 1, '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1008, '角色新增', 101, 2, '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:add', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1009, '角色修改', 101, 3, '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:edit', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1010, '角色删除', 101, 4, '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:remove', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1011, '角色导出', 101, 5, '', '', '', '', 1, 0, 'F', '0', '0', 'system:role:export', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1012, '菜单查询', 102, 1, '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1013, '菜单新增', 102, 2, '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:add', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1014, '菜单修改', 102, 3, '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:edit', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1015, '菜单删除', 102, 4, '', '', '', '', 1, 0, 'F', '0', '0', 'system:menu:remove', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1016, '部门查询', 103, 1, '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1017, '部门新增', 103, 2, '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:add', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1018, '部门修改', 103, 3, '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:edit', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1019, '部门删除', 103, 4, '', '', '', '', 1, 0, 'F', '0', '0', 'system:dept:remove', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1020, '岗位查询', 104, 1, '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1021, '岗位新增', 104, 2, '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:add', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1022, '岗位修改', 104, 3, '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:edit', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1023, '岗位删除', 104, 4, '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:remove', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1024, '岗位导出', 104, 5, '', '', '', '', 1, 0, 'F', '0', '0', 'system:post:export', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1025, '字典查询', 105, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1026, '字典新增', 105, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:add', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1027, '字典修改', 105, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:edit', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1028, '字典删除', 105, 4, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:remove', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1029, '字典导出', 105, 5, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:dict:export', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1030, '参数查询', 106, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1031, '参数新增', 106, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:add', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1032, '参数修改', 106, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:edit', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1033, '参数删除', 106, 4, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:remove', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1034, '参数导出', 106, 5, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:config:export', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1035, '公告查询', 107, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1036, '公告新增', 107, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:add', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1037, '公告修改', 107, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:edit', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1038, '公告删除', 107, 4, '#', '', '', '', 1, 0, 'F', '0', '0', 'system:notice:remove', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1039, '操作查询', 500, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1040, '操作删除', 500, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:remove', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1041, '日志导出', 500, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:operlog:export', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1042, '登录查询', 501, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1043, '登录删除', 501, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:remove', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1044, '日志导出', 501, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:export', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1045, '账户解锁', 501, 4, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:logininfor:unlock', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1046, '在线查询', 109, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:online:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1047, '批量强退', 109, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:online:batchLogout', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1048, '单条强退', 109, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:online:forceLogout', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1049, '任务查询', 110, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1050, '任务新增', 110, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:add', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1051, '任务修改', 110, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:edit', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1052, '任务删除', 110, 4, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:remove', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1053, '状态修改', 110, 5, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:changeStatus', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1054, '任务导出', 110, 6, '#', '', '', '', 1, 0, 'F', '0', '0', 'monitor:job:export', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1055, '生成查询', 116, 1, '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1056, '生成修改', 116, 2, '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:edit', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1057, '生成删除', 116, 3, '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:remove', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1058, '导入代码', 116, 4, '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:import', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1059, '预览代码', 116, 5, '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:preview', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (1060, '生成代码', 116, 6, '#', '', '', '', 1, 0, 'F', '0', '0', 'tool:gen:code', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2000, '数据集成管理', 0, 4, '/offline-data', NULL, NULL, '', 1, 0, 'M', '0', '0', '', 'druid', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2001, '数据集成应用', 2000, 1, '/restcloud/admin/process/pageid/ListApplications', 'etl', '', '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2002, '流程全文检索', 2000, 2, '/restcloud/admin/process/pageid/processSearch', 'etl', '', '', 1, 0, 'C', '0', '0', '', 'druid', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2003, '调度计划全景', 2000, 3, '/restcloud/admin/process/pageid/timingSchedule', 'etl', '', '', 1, 0, 'C', '0', '0', '', 'druid', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2004, '数据处理组件', 2000, 4, '/restcloud/admin/process/pageid/module', 'etl', '', '', 1, 0, 'C', '0', '0', '', 'druid', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2005, '数据处理规则', 2000, 5, '/etl/offline/rule', NULL, NULL, '', 1, 0, 'M', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2006, '平台内置规则', 2005, 1, '/restcloud/admin/process/pageid/platformRules', 'etl', '', '', 1, 0, 'C', '0', '0', '', 'druid', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2008, '应用定义规则', 2005, 2, '/restcloud/admin/process/pageid/myRules', 'etl', '', '', 1, 0, 'C', '0', '0', '', 'druid', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2009, '数据源管理-停用', 2183, 6, '/data-source', NULL, NULL, '', 1, 0, 'M', '1', '1', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2010, '数据源列表', 2009, 1, '/data-source/list', NULL, NULL, '', 1, 0, 'M', '1', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2011, '数据源分类管理', 2009, 2, '/restcloud/admin/datasource/pageid/dataSourceCategory', 'etl', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2012, '数据源组件管理', 2009, 3, '/restcloud/admin/datasource/pageid/dataSourceComponentCategory', 'etl', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2013, '所有数据源', 2009, 1, '/restcloud/admin/datasource/pageid/all', 'etl', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2014, 'Oracle', 2010, 2, '/restcloud/admin/datasource@Oracle', 'etl', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2015, 'SqlServer', 2010, 3, '/restcloud/admin/datasource@SqlServer', 'etl', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2016, 'MySql', 2010, 4, '/restcloud/admin/datasource@MySql', 'etl', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2017, 'PostgresSQL', 2010, 5, '/restcloud/admin/datasource@PostgresSQL', 'etl', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2018, 'MongoDB', 2010, 6, '/restcloud/admin/datasource@MongoDB', 'etl', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2019, 'Kafka', 2010, 7, '/restcloud/admin/datasource@Kafka', 'etl', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2020, 'Greenplum', 2010, 8, '/restcloud/admin/datasource@Greenplum', 'etl', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2021, 'Sybase', 2010, 9, '/restcloud/admin/datasource@Sybase', 'etl', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2022, 'ClickHouse', 2010, 10, '/restcloud/admin/datasource@ClickHouse', 'etl', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2024, 'SQL开发管理-停用', 2183, 7, '/sql-development', NULL, NULL, '', 1, 0, 'M', '1', '1', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2025, '实时数据集成', 0, 8, '/realtime-data', NULL, NULL, '', 1, 0, 'M', '0', '0', '', 'chart', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2026, '概览', 2025, 1, '/restcloud/admin/cdc/pageid/home', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2027, '数据库监听器', 2025, 2, '/restcloud/admin/cdc/pageid/ListETLCDCDebezium', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2028, 'kafka监听器', 2025, 3, '/restcloud/admin/cdc/pageid/ListKafKaCDCDebezium', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2029, 'MQ监听器', 2025, 4, '/restcloud/admin/cdc/pageid/ListMQ', 'etl', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2030, '协议监听器', 2025, 5, '/restcloud/admin/cdc/pageid/ListOtherProtocol', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2031, '数据服务开发', 0, 9, '/data-service', NULL, NULL, '', 1, 0, 'M', '0', '0', '', 'component', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2032, '所有应用', 2031, 1, '/restcloud/admin/application/pageid/ListAllApps', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2033, '我的应用', 2031, 2, '/restcloud/admin/application/pageid/ListMyApps', 'etl', NULL, '', 1, 0, 'C', '1', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2034, '系统应用', 2031, 3, '/restcloud/admin/application/pageid/core', 'etl', NULL, '', 1, 0, 'C', '1', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2035, '开发测试', 2031, 4, '/restcloud/admin/application/pageid/dev', 'etl', NULL, '', 1, 0, 'C', '1', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2036, '应用管理', 2031, 5, '/restcloud/admin/application/pageid/AppManager', 'etl', NULL, '', 1, 0, 'C', '1', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2037, '版本管理', 2031, 6, '/restcloud/admin/application/pageid/AppVersionManager', 'etl', NULL, '', 1, 0, 'C', '1', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2038, '数据资产管理-停用', 2183, 10, '/data-assest', NULL, NULL, '', 1, 0, 'M', '1', '1', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2039, '所有资产列表', 2038, 1, '/restcloud/admin/dataasset/pageid/all', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2040, '分类列表', 2038, 2, '/restcloud/admin/dataasset/pageid/metadataCategory', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2041, '所有SQL列表', 2024, 1, '/restcloud/admin/sql/pageid/all', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2042, '平台配置', 0, 11, '/platform', NULL, NULL, '', 1, 0, 'M', '0', '0', '', 'edit', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2043, '平台参数配置', 2042, 1, '/restcloud/admin/pageid/Setting_PlatformSetting', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2044, '资源组管理', 2042, 2, '/restcloud/admin/pageid/Setting_SourceSetting', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2045, '定时任务设置', 2042, 3, '/restcloud/admin/pageid/Setting_Scheduler', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2046, '一键备份升级', 2042, 4, '/restcloud/admin/pageid/BackupAndUpdate', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2047, '平台模板代码', 2042, 5, '/restcloud/admin/pageid/Setting_PlatformTemplate', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2048, '监控中心', 0, 12, '/data-monitor', NULL, NULL, '', 1, 0, 'M', '0', '0', '', 'monitor', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2049, '监控首页', 2048, 1, '/restcloud/admin/etlMonitor', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2050, '运行监控', 2048, 2, '/data-monitor/running', NULL, NULL, '', 1, 0, 'M', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2051, '运行预警', 2048, 3, '/data-monitor/warning', NULL, NULL, '', 1, 0, 'M', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2052, '运行统计', 2048, 4, '/data-monitor/statistics', NULL, NULL, '', 1, 0, 'M', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2053, '运行分析', 2048, 5, '/data-monitor/anlyse', NULL, NULL, '', 1, 0, 'M', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2054, '平台监控', 2048, 6, '/data-monitor/platform', NULL, NULL, '', 1, 0, 'M', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2055, '任务运行计划', 2050, 1, '/restcloud/admin/etlMonitor@任务运行计划', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2056, '任务队列', 2050, 2, '/restcloud/admin/etlMonitor@任务队列', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2057, '运行任务', 2050, 3, '/restcloud/admin/etlMonitor@运行任务', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2058, '运行日志', 2050, 4, '/restcloud/admin/etlMonitor@运行日志', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2059, '数据流监控', 2050, 5, '/restcloud/admin/etlMonitor@数据流监控', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2060, '执行流程异常', 2051, 1, '/restcloud/admin/etlMonitor@执行流程异常', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2061, '自动运行流程统计', 2052, 1, '/restcloud/admin/etlMonitor@自动运行流程统计', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2062, '任务领取分布统计', 2052, 2, '/restcloud/admin/etlMonitor@任务领取分布统计', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2063, '调度运行趋势分析', 2053, 1, '/restcloud/admin/etlMonitor@调度运行趋势分析', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2064, '数据传输趋势分析', 2053, 2, '/restcloud/admin/etlMonitor@数据传输趋势分析', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2065, '服务器资源耗用趋势分析', 2053, 3, '/restcloud/admin/etlMonitor@服务器资源耗用趋势分析', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2066, '控制台日志', 2054, 1, '/restcloud/admin/etlMonitor@控制台日志', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2067, '内存及线程监控', 2054, 2, '/restcloud/admin/etlMonitor@内存及线程监控', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2068, '集群服务器', 2054, 3, '/restcloud/admin/etlMonitor@集群服务器', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2069, '所有加载的Bean', 2054, 4, '/restcloud/admin/etlMonitor@所有加载的Bean', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2070, '异常的JavaBean', 2054, 5, '/restcloud/admin/etlMonitor@异常的JavaBean', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2071, '已失效的API', 2054, 6, '/restcloud/admin/etlMonitor@已失效的API', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2072, '加载的Jar包列表', 2054, 7, '/restcloud/admin/etlMonitor@加载的Jar包列表', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2073, '用户登录日志', 2054, 8, '/restcloud/admin/etlMonitor@用户登录日志', 'etl', NULL, '', 1, 0, 'C', '1', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2074, '系统操作日志', 2054, 9, '/restcloud/admin/etlMonitor@系统操作日志', 'etl', NULL, '', 1, 0, 'C', '1', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2075, 'API调用日志', 2054, 10, '/restcloud/admin/etlMonitor@API调用日志', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2076, '搜索API日志', 2054, 11, '/restcloud/admin/etlMonitor@搜索API日志', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2077, '系统回收站', 2054, 12, '/restcloud/admin/etlMonitor@系统回收站', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2078, '分类管理', 2024, 2, '/restcloud/admin/sql@分类管理', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2079, '流程模板管理', 2000, 6, '/offline/template', NULL, NULL, '', 1, 0, 'M', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2080, '所有模板列表', 2079, 1, '/restcloud/admin/process/pageid/template', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2081, '模板分类设置', 2079, 2, '/restcloud/admin/process/pageid/templateCategory', 'etl', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2082, '统计分析', 2000, 7, '/offline/statistics', NULL, NULL, '', 1, 0, 'M', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2083, '数据源关系分析', 2082, 1, '/restcloud/admin/process/pageid/DataSourceDependencies', 'etl', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2084, '血缘关系分析', 2082, 2, '/restcloud/admin/process/pageid/TableDependencies', 'etl', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2086, '离线应用详情', 2183, 100, '/restcloud/admin/process/application', 'etl', NULL, '', 1, 0, 'C', '1', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2088, '数据源管理', 0, 9, '/restcloud/admin/datasource', 'etl', '{\"showMenu\": \"1\"}', '', 1, 0, 'C', '0', '0', '', 'list', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2089, '数据资产管理', 2183, 151, '/restcloud/admin/dataasset', 'etl', '{\"showMenu\":\"1\"}', '', 1, 0, 'C', '0', '0', '', 'redis', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2090, '数据标签管理', 2183, 15, '/restcloud/admin/sql', 'etl', '{\"showMenu\":\"1\"}', '', 1, 0, 'C', '0', '0', '', 'table', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2091, '元数据标签', 2000, 8, '/offline-data/meta-tag', 'metadata/tag.vue', NULL, '', 1, 0, 'C', '0', '1', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2112, '我的订阅', 1, 8, 'info', 'message/index', NULL, '', 1, 0, 'C', '0', '0', 'subscribe:info:list', 'log', 'admin', NULL, 'admin', NULL, '订阅信息菜单');
INSERT INTO sys_menu VALUES (2113, '订阅信息查询', 2112, 1, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'subscribe:info:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2114, '订阅/取消订阅', 2112, 2, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'subscribe:record:edit', '#', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2115, '读订阅信息', 2112, 3, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'subscribe:info:read', '#', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2125, '数据安全管理', 0, 5, 'security', NULL, NULL, '', 1, 0, 'M', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2126, '密级管理', 2125, 1, 'level', 'security/level', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2127, '密点管理', 2125, 2, 'point', 'security/point', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2128, '数据标准管理', 0, 2, 'standard', NULL, NULL, '', 1, 0, 'M', '0', '0', '', 'chart', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2129, '指标管理', 2128, 1, 'target', 'standard/targetss/index', NULL, '', 1, 0, 'C', '0', '0', '', 'component', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2130, '审批管理', 0, 6, 'approval', NULL, NULL, '', 1, 0, 'M', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2131, '指标审批', 2130, 1, 'targetApproval', 'approval/targetApproval/index', NULL, '', 1, 0, 'C', '0', '0', '', 'form', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2132, '跨网数据传输', 0, 7, 'transfer', 'transfer/index', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2133, '元数据管理', 0, 3, 'metadata', NULL, NULL, '', 1, 0, 'M', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2134, '标签管理', 2133, 1, 'tag', 'metadata/tag', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2135, '元数据管理', 2133, 2, 'metadata', 'metadata/metadata', NULL, '', 1, 0, 'C', '0', '0', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2136, '指标审批列表', 2131, 1, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'approve:approve:list', '#', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2137, '指标审批详情', 2131, 2, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'approve:approve:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2138, '处理指标审批', 2131, 3, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'approve:approve:handle', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2139, '指标列表', 2129, 1, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'indicator:indicator:list', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2140, '指标导出', 2129, 2, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'indicator:indicator:export', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2141, '指标详情', 2129, 3, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'indicator:indicator:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2142, '指标导入', 2129, 4, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'indicator:indicator:import', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2143, '新增指标', 2129, 5, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'indicator:indicator:add', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2144, '修改指标', 2129, 6, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'indicator:indicator:edit', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2145, '删除指标', 2129, 7, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'indicator:indicator:remove', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2146, '密级列表', 2126, 0, 'levels', '', NULL, '', 1, 0, 'F', '0', '0', 'security:levels:list', '#', 'admin', NULL, 'admin', NULL, '密级菜单');
INSERT INTO sys_menu VALUES (2147, '密级查询', 2126, 1, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'security:levels:query', '#', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2148, '密级新增', 2126, 2, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'security:levels:add', '#', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2149, '密级修改', 2126, 3, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'security:levels:edit', '#', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2150, '密级删除', 2126, 4, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'security:levels:remove', '#', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2151, '人员清单', 2126, 5, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'security:levels:userlist', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2152, '数据资产目录', 2183, 1, 'assets', NULL, NULL, '', 1, 0, 'M', '0', '1', '', 'documentation', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2153, '资产目录', 2152, 1, 'index', 'assets/index', NULL, '', 1, 0, 'C', '0', '0', NULL, 'documentation', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2154, '元数据标签', 2134, 1, 'tag', 'metadata/tag/index', NULL, '', 1, 0, 'F', '0', '0', 'metadata:tag:list', '#', 'admin', NULL, 'admin', NULL, '元数据标签菜单');
INSERT INTO sys_menu VALUES (2155, '元数据标签查询', 2134, 1, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'metadata:tag:query', '#', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2156, '元数据标签新增', 2134, 2, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'metadata:tag:add', '#', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2157, '元数据标签修改', 2134, 3, '#', '', NULL, '', 1, 0, 'F', '0', '0', 'metadata:tag:edit', '#', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2158, '查询元数据列表', 2135, 1, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'metadata:metadata:list', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2159, '元数据字段详细信息', 2135, 2, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'metadata:metadata:field', '#', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2160, '元数据标签关联列表', 2134, 4, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'metadata:relation:relationlist', '#', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2161, '新增元数据标签关联', 2135, 3, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'metadata:relation:add', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2162, '获取表字段详情', 2132, 0, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'network:transfer:tablefield', '#', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2163, '获取表详情', 2132, 1, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'network:transfer:table', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2164, '预览数据', 2132, 2, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'network:transfer:previewdata', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2165, '跨网传输列表', 2132, 3, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'network:transfer:list', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2166, '跨网传输详细信息', 2132, 4, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'network:transfer:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2167, '新增跨网传输', 2132, 5, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'network:transfer:add', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2168, '跨网审批', 2130, 2, 'transferApproval', 'approval/transferApproval/index', NULL, '', 1, 0, 'C', '0', '0', '', 'excel', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2169, '跨网审批列表', 2168, 0, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'approve:approve:list', '#', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2170, '跨网审批详情', 2168, 1, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'approve:approve:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2171, '处理跨网审批', 2168, 3, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'approve:approve:handle', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2172, '密点关联列表', 2127, 0, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'security:points:relationlist', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2173, '密点列表', 2127, 1, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'security:points:list', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2174, '密点详情', 2127, 2, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'security:points:query', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2175, '新增密点', 2127, 3, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'security:points:add', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2176, '修改密点', 2127, 4, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'security:points:edit', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2177, '删除密点', 2127, 5, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'security:points:remove', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2178, '撤回跨网传输', 2132, 6, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'network:transfer:revoke', '#', 'admin', NULL, 'admin', NULL, '');
INSERT INTO sys_menu VALUES (2179, '新增文件传输', 2132, 7, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'network:transfer:file', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2180, '预览数据', 2168, 4, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'approve:approve:previewdata', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2181, '引用上一次', 2132, 8, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'network:transfer:last', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2182, '元数据预览数据', 2135, 4, '', NULL, NULL, '', 1, 0, 'F', '0', '0', 'metadata:metadata:preview', '#', 'admin', NULL, '', NULL, '');
INSERT INTO sys_menu VALUES (2183, '隐藏菜单', 0, 100, 'cancel_index', NULL, NULL, '', 1, 0, 'C', '1', '0', '', 'build', 'admin', NULL, 'admin', NULL, '');

-- 创建序列对象，用于主键自增
CREATE SEQUENCE seq_sys_notice
    INCREMENT BY 1
    START WITH 1
    NOMAXVALUE
    NOMINVALUE
    CACHE 20;

-- 创建 sys_notice 表
CREATE TABLE sys_notice (
                            notice_id     INT NOT NULL, -- 公告ID
                            notice_title  VARCHAR2(50) NOT NULL, -- 公告标题
                            notice_type   CHAR(1) NOT NULL, -- 公告类型（1通知 2公告）
                            notice_content CLOB, -- 公告内容
                            status        CHAR(1) DEFAULT '0', -- 公告状态（0正常 1关闭）
                            create_by     VARCHAR2(64) DEFAULT '', -- 创建者
                            create_time   DATETIME DEFAULT NULL, -- 创建时间
                            update_by     VARCHAR2(64) DEFAULT '', -- 更新者
                            update_time   DATETIME DEFAULT NULL, -- 更新时间
                            remark        VARCHAR2(255) DEFAULT NULL -- 备注
);

-- 添加主键约束
ALTER TABLE sys_notice ADD CONSTRAINT pk_sys_notice PRIMARY KEY (notice_id);

-- 添加注释
COMMENT ON TABLE sys_notice IS '通知公告表';
COMMENT ON COLUMN sys_notice.notice_id IS '公告ID';
COMMENT ON COLUMN sys_notice.notice_title IS '公告标题';
COMMENT ON COLUMN sys_notice.notice_type IS '公告类型（1通知 2公告）';
COMMENT ON COLUMN sys_notice.notice_content IS '公告内容';
COMMENT ON COLUMN sys_notice.status IS '公告状态（0正常 1关闭）';
COMMENT ON COLUMN sys_notice.create_by IS '创建者';
COMMENT ON COLUMN sys_notice.create_time IS '创建时间';
COMMENT ON COLUMN sys_notice.update_by IS '更新者';
COMMENT ON COLUMN sys_notice.update_time IS '更新时间';
COMMENT ON COLUMN sys_notice.remark IS '备注';


-- 创建序列对象，用于主键自增
CREATE SEQUENCE seq_sys_oper_log
    INCREMENT BY 1
    START WITH 1
    NOMAXVALUE
    NOMINVALUE
    CACHE 20;

-- 创建 sys_oper_log 表
CREATE TABLE sys_oper_log (
                              oper_id        BIGINT NOT NULL, -- 日志主键
                              title          VARCHAR2(50) DEFAULT '', -- 模块标题
                              business_type  INT DEFAULT 0, -- 业务类型（0其它 1新增 2修改 3删除）
                              method         VARCHAR2(200) DEFAULT '', -- 方法名称
                              request_method VARCHAR2(10) DEFAULT '', -- 请求方式
                              operator_type  INT DEFAULT 0, -- 操作类别（0其它 1后台用户 2手机端用户）
                              oper_name      VARCHAR2(50) DEFAULT '', -- 操作人员
                              dept_name      VARCHAR2(50) DEFAULT '', -- 部门名称
                              oper_url       VARCHAR2(255) DEFAULT '', -- 请求URL
                              oper_ip        VARCHAR2(128) DEFAULT '', -- 主机地址
                              oper_location  VARCHAR2(255) DEFAULT '', -- 操作地点
                              oper_param     VARCHAR2(2000) DEFAULT '', -- 请求参数
                              json_result    VARCHAR2(2000) DEFAULT '', -- 返回参数
                              status         INT DEFAULT 0, -- 操作状态（0正常 1异常）
                              error_msg      VARCHAR2(2000) DEFAULT '', -- 错误消息
                              oper_time      DATETIME DEFAULT NULL, -- 操作时间
                              cost_time      BIGINT DEFAULT 0 -- 消耗时间
);

-- 添加主键约束
ALTER TABLE sys_oper_log ADD CONSTRAINT pk_sys_oper_log PRIMARY KEY (oper_id);

-- 添加索引
CREATE INDEX idx_sys_oper_log_bt ON sys_oper_log (business_type ASC);
CREATE INDEX idx_sys_oper_log_s ON sys_oper_log (status ASC);
CREATE INDEX idx_sys_oper_log_ot ON sys_oper_log (oper_time ASC);

-- 添加注释
COMMENT ON TABLE sys_oper_log IS '操作日志记录';
COMMENT ON COLUMN sys_oper_log.oper_id IS '日志主键';
COMMENT ON COLUMN sys_oper_log.title IS '模块标题';
COMMENT ON COLUMN sys_oper_log.business_type IS '业务类型（0其它 1新增 2修改 3删除）';
COMMENT ON COLUMN sys_oper_log.method IS '方法名称';
COMMENT ON COLUMN sys_oper_log.request_method IS '请求方式';
COMMENT ON COLUMN sys_oper_log.operator_type IS '操作类别（0其它 1后台用户 2手机端用户）';
COMMENT ON COLUMN sys_oper_log.oper_name IS '操作人员';
COMMENT ON COLUMN sys_oper_log.dept_name IS '部门名称';
COMMENT ON COLUMN sys_oper_log.oper_url IS '请求URL';
COMMENT ON COLUMN sys_oper_log.oper_ip IS '主机地址';
COMMENT ON COLUMN sys_oper_log.oper_location IS '操作地点';
COMMENT ON COLUMN sys_oper_log.oper_param IS '请求参数';
COMMENT ON COLUMN sys_oper_log.json_result IS '返回参数';
COMMENT ON COLUMN sys_oper_log.status IS '操作状态（0正常 1异常）';
COMMENT ON COLUMN sys_oper_log.error_msg IS '错误消息';
COMMENT ON COLUMN sys_oper_log.oper_time IS '操作时间';
COMMENT ON COLUMN sys_oper_log.cost_time IS '消耗时间';

-- 创建触发器，实现主键自增
CREATE OR REPLACE TRIGGER trg_sys_oper_log_before_insert
    BEFORE INSERT ON sys_oper_log
    FOR EACH ROW
BEGIN
    SELECT seq_sys_oper_log.NEXTVAL INTO :NEW.oper_id FROM DUAL;
END;

-- 创建序列对象，用于主键自增
CREATE SEQUENCE seq_sys_post
    INCREMENT BY 1
    START WITH 1
    NOMAXVALUE
    NOMINVALUE
    CACHE 20;

-- 创建 sys_post 表
CREATE TABLE sys_post (
                          post_id      BIGINT NOT NULL, -- 岗位ID
                          post_code    VARCHAR2(64) NOT NULL, -- 岗位编码
                          post_name    VARCHAR2(50) NOT NULL, -- 岗位名称
                          post_sort    INT NOT NULL, -- 显示顺序
                          status       CHAR(1) NOT NULL, -- 状态（0正常 1停用）
                          create_by    VARCHAR2(64) DEFAULT '', -- 创建者
                          create_time  DATETIME DEFAULT NULL, -- 创建时间
                          update_by    VARCHAR2(64) DEFAULT '', -- 更新者
                          update_time  DATETIME DEFAULT NULL, -- 更新时间
                          remark       VARCHAR2(500) DEFAULT NULL -- 备注
);

-- 添加主键约束
ALTER TABLE sys_post ADD CONSTRAINT pk_sys_post PRIMARY KEY (post_id);

-- 添加注释
COMMENT ON TABLE sys_post IS '岗位信息表';
COMMENT ON COLUMN sys_post.post_id IS '岗位ID';
COMMENT ON COLUMN sys_post.post_code IS '岗位编码';
COMMENT ON COLUMN sys_post.post_name IS '岗位名称';
COMMENT ON COLUMN sys_post.post_sort IS '显示顺序';
COMMENT ON COLUMN sys_post.status IS '状态（0正常 1停用）';
COMMENT ON COLUMN sys_post.create_by IS '创建者';
COMMENT ON COLUMN sys_post.create_time IS '创建时间';
COMMENT ON COLUMN sys_post.update_by IS '更新者';
COMMENT ON COLUMN sys_post.update_time IS '更新时间';
COMMENT ON COLUMN sys_post.remark IS '备注';


-- 创建序列对象，用于主键自增
CREATE SEQUENCE seq_sys_role
    INCREMENT BY 1
    START WITH 1
    NOMAXVALUE
    NOMINVALUE
    CACHE 20;

-- 创建 sys_role 表
CREATE TABLE sys_role (
                          role_id            BIGINT NOT NULL, -- 角色ID
                          role_name          VARCHAR2(30) NOT NULL, -- 角色名称
                          role_key           VARCHAR2(100) NOT NULL, -- 角色权限字符串
                          role_sort          INT NOT NULL, -- 显示顺序
                          data_scope         CHAR(1) DEFAULT '1', -- 数据范围（1：全部数据权限 2：自定数据权限 3：本部门数据权限 4：本部门及以下数据权限）
                          menu_check_strictly SMALLINT DEFAULT 1, -- 菜单树选择项是否关联显示
                          dept_check_strictly SMALLINT DEFAULT 1, -- 部门树选择项是否关联显示
                          status             CHAR(1) NOT NULL, -- 角色状态（0正常 1停用）
                          del_flag           CHAR(1) DEFAULT '0', -- 删除标志（0代表存在 2代表删除）
                          create_by          VARCHAR2(64) DEFAULT '', -- 创建者
                          create_time        DATETIME DEFAULT NULL, -- 创建时间
                          update_by          VARCHAR2(64) DEFAULT '', -- 更新者
                          update_time        DATETIME DEFAULT NULL, -- 更新时间
                          remark             VARCHAR2(500) DEFAULT NULL -- 备注
);

-- 添加主键约束
ALTER TABLE sys_role ADD CONSTRAINT pk_sys_role PRIMARY KEY (role_id);

-- 添加注释
COMMENT ON TABLE sys_role IS '角色信息表';
COMMENT ON COLUMN sys_role.role_id IS '角色ID';
COMMENT ON COLUMN sys_role.role_name IS '角色名称';
COMMENT ON COLUMN sys_role.role_key IS '角色权限字符串';
COMMENT ON COLUMN sys_role.role_sort IS '显示顺序';
COMMENT ON COLUMN sys_role.data_scope IS '数据范围（1：全部数据权限 2：自定数据权限 3：本部门数据权限 4：本部门及以下数据权限）';
COMMENT ON COLUMN sys_role.menu_check_strictly IS '菜单树选择项是否关联显示';
COMMENT ON COLUMN sys_role.dept_check_strictly IS '部门树选择项是否关联显示';
COMMENT ON COLUMN sys_role.status IS '角色状态（0正常 1停用）';
COMMENT ON COLUMN sys_role.del_flag IS '删除标志（0代表存在 2代表删除）';
COMMENT ON COLUMN sys_role.create_by IS '创建者';
COMMENT ON COLUMN sys_role.create_time IS '创建时间';
COMMENT ON COLUMN sys_role.update_by IS '更新者';
COMMENT ON COLUMN sys_role.update_time IS '更新时间';
COMMENT ON COLUMN sys_role.remark IS '备注';


-- 创建 sys_role_dept 表
CREATE TABLE sys_role_dept (
                               role_id   BIGINT NOT NULL, -- 角色ID
                               dept_id   BIGINT NOT NULL, -- 部门ID
                               PRIMARY KEY (role_id, dept_id)
);

-- 添加注释
COMMENT ON TABLE sys_role_dept IS '角色和部门关联表';
COMMENT ON COLUMN sys_role_dept.role_id IS '角色ID';
COMMENT ON COLUMN sys_role_dept.dept_id IS '部门ID';

-- 创建 sys_role_menu 表
CREATE TABLE sys_role_menu (
                               role_id   BIGINT NOT NULL, -- 角色ID
                               menu_id   BIGINT NOT NULL, -- 菜单ID
                               PRIMARY KEY (role_id, menu_id)
);

-- 添加注释
COMMENT ON TABLE sys_role_menu IS '角色和菜单关联表';
COMMENT ON COLUMN sys_role_menu.role_id IS '角色ID';
COMMENT ON COLUMN sys_role_menu.menu_id IS '菜单ID';

-- 创建 sys_user_post 表
CREATE TABLE sys_user_post (
                               user_id BIGINT NOT NULL, -- 用户ID
                               post_id BIGINT NOT NULL, -- 岗位ID
                               PRIMARY KEY (user_id, post_id)
);

-- 添加注释
COMMENT ON TABLE sys_user_post IS '用户与岗位关联表';
COMMENT ON COLUMN sys_user_post.user_id IS '用户ID';
COMMENT ON COLUMN sys_user_post.post_id IS '岗位ID';

-- 创建 sys_user_role 表
CREATE TABLE sys_user_role (
                               user_id BIGINT NOT NULL, -- 用户ID
                               role_id BIGINT NOT NULL, -- 角色ID
                               PRIMARY KEY (user_id, role_id)
);

-- 添加注释
COMMENT ON TABLE sys_user_role IS '用户和角色关联表';
COMMENT ON COLUMN sys_user_role.user_id IS '用户ID';
COMMENT ON COLUMN sys_user_role.role_id IS '角色ID';


-- 创建序列对象，用于主键自增
CREATE SEQUENCE seq_sys_user
    INCREMENT BY 1
    START WITH 1
    NOMAXVALUE
    NOMINVALUE
    CACHE 20;

-- 创建 sys_user 表
CREATE TABLE sys_user (
                          user_id       BIGINT NOT NULL, -- 用户ID
                          dept_id       VARCHAR2(50) DEFAULT NULL, -- 部门ID
                          user_name     VARCHAR2(30) NOT NULL, -- 用户账号
                          nick_name     VARCHAR2(30) NOT NULL, -- 用户昵称
                          user_type     VARCHAR2(2) DEFAULT '00', -- 用户类型（00系统用户）
                          email         VARCHAR2(50) DEFAULT '', -- 用户邮箱
                          phonenumber   VARCHAR2(11) DEFAULT '', -- 手机号码
                          sex           CHAR(1) DEFAULT '0', -- 用户性别（0男 1女 2未知）
                          avatar        VARCHAR2(100) DEFAULT '', -- 头像地址
                          password      VARCHAR2(100) DEFAULT '', -- 密码
                          status        CHAR(1) DEFAULT '0', -- 帐号状态（0正常 1停用）
                          del_flag      CHAR(1) DEFAULT '0', -- 删除标志（0代表存在 2代表删除）
                          login_id      VARCHAR2(255) DEFAULT NULL, -- 登录ID
                          login_ip      VARCHAR2(128) DEFAULT '', -- 最后登录IP
                          login_date    DATETIME DEFAULT NULL, -- 最后登录时间
                          create_by     VARCHAR2(64) DEFAULT '', -- 创建者
                          create_time   DATETIME DEFAULT NULL, -- 创建时间
                          update_by     VARCHAR2(64) DEFAULT '', -- 更新者
                          update_time   DATETIME DEFAULT NULL, -- 更新时间
                          remark        VARCHAR2(500) DEFAULT NULL, -- 备注
                          level         VARCHAR2(255) DEFAULT NULL, -- 人员密级等级
                          dept_code     VARCHAR2(60) DEFAULT NULL, -- 同步部门编码
                          PRIMARY KEY (user_id)
);

-- 添加注释
COMMENT ON TABLE sys_user IS '用户信息表';
COMMENT ON COLUMN sys_user.user_id IS '用户ID';
COMMENT ON COLUMN sys_user.dept_id IS '部门ID';
COMMENT ON COLUMN sys_user.user_name IS '用户账号';
COMMENT ON COLUMN sys_user.nick_name IS '用户昵称';
COMMENT ON COLUMN sys_user.user_type IS '用户类型（00系统用户）';
COMMENT ON COLUMN sys_user.email IS '用户邮箱';
COMMENT ON COLUMN sys_user.phonenumber IS '手机号码';
COMMENT ON COLUMN sys_user.sex IS '用户性别（0男 1女 2未知）';
COMMENT ON COLUMN sys_user.avatar IS '头像地址';
COMMENT ON COLUMN sys_user.password IS '密码';
COMMENT ON COLUMN sys_user.status IS '帐号状态（0正常 1停用）';
COMMENT ON COLUMN sys_user.del_flag IS '删除标志（0代表存在 2代表删除）';
COMMENT ON COLUMN sys_user.login_id IS '登录ID';
COMMENT ON COLUMN sys_user.login_ip IS '最后登录IP';
COMMENT ON COLUMN sys_user.login_date IS '最后登录时间';
COMMENT ON COLUMN sys_user.create_by IS '创建者';
COMMENT ON COLUMN sys_user.create_time IS '创建时间';
COMMENT ON COLUMN sys_user.update_by IS '更新者';
COMMENT ON COLUMN sys_user.update_time IS '更新时间';
COMMENT ON COLUMN sys_user.remark IS '备注';
COMMENT ON COLUMN sys_user.level IS '人员密级等级';
COMMENT ON COLUMN sys_user.dept_code IS '同步部门编码';

INSERT INTO sys_user
VALUES (1, '0', 'admin', '管理员', '00', 'ry@163.com', '15888888888', '1',
        '/profile/avatar/2025/02/07/default_handsome_20250207133141A007.jpg', '9gzDffgytQIiJHOdzVdFRA==', '0', '0',
        NULL, '127.0.0.1', '', 'admin', '', '', '', '管理员', '3', NULL);

CREATE OR REPLACE TRIGGER trg_sys_user_before_insert
    BEFORE INSERT ON sys_user
    FOR EACH ROW
BEGIN
    SELECT seq_sys_user.NEXTVAL INTO :NEW.user_id FROM DUAL;
END;



